The following code works as expected in ksh88:
$ echo "pat\c" | read pat;echo "pat='$pat'"
pat='pat'
in ksh93:
$ ksh93
$ echo "pat\c" | read pat;echo "pat='$pat'"
pat='pa'
$ exit;dtksh
$ echo "pat\c" | read pat;echo "pat='$pat'"
pat='pa'
I discovered this quite by accident while adding functionality to
nedit. I wrote a nedit macro that selects the current word
and filters it to a dtksh script. The filtering process cats the file
without a newline. The dtksh reads the pattern, then uses it to
grep a database of Applix macro names and completes the macro. If
more than 1 name is found, a Selection Box dialog is posted so you
can select the correct function. I used:
read pat
to get the pattern, but it kept coming back 1 char short. I had to
change that to:
pat="$(cat)"
Opinions expressed herein are my own and may not represent those of my employer.