Read bug in ksh93 (dtksh)

Read bug in ksh93 (dtksh)

Post by Dan Merc » Sat, 31 Oct 1998 04:00:00



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.

 
 
 

Read bug in ksh93 (dtksh)

Post by Dan Merc » Sat, 31 Oct 1998 04:00:00


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.

 
 
 

1. Read bug in ksh93 (dtksh)

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.

2. Can LILO Boot DOS From Second IDE Drive?

3. dtksh (HP-UX ksh93) as login shell

4. Backup with EMC solution

5. cut/paste problem: dtksh vs ksh93

6. login: ERROR: No such user!

7. Subject: Ksh93 question: special built-ins: why are they special?

8. video card advice

9. dtksh ${$} in heredoc bug?

10. dtksh (ksh 93) timed read

11. ksh93 typeset -i with zero bug?

12. ksh93 backreference bug?

13. Strange associative array bug in ksh93