vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| When the following construct is processed by ksh running on OpenBSD 3.9 release (cd), a CR is left appended to the end of $REPLY. That newline shows up at the end of the last argument processed by the C program mychk. cat mesglog | while read do mychk $REPLY done Is this the expected behavior of ksh? (My 1989 version of _The Kornshell says that the newline is removed). Thanks, Dave Feustel -- Using OpenBSD with or without X & KDE? http://dfeustel.home.mindspring.com |
| |||
| dfeustel@mindspring.com wrote in news:vCmog.6030$il.4542@trnddc03: > When the following construct is processed by ksh > running on OpenBSD 3.9 release (cd), a CR is left > appended to the end of $REPLY. > ... > Is this the expected behavior of ksh? > (My 1989 version of _The Kornshell says that the > newline is removed). CR (ascii 13) != newline (ascii 10) "Only" space, tab and newline are in $IFS That the tty line disipline usually converts CR input from keyboard to NL (stty icrnl) doesn't matter for files |
| |||
| "Peter Str?mberg" <wilfried@spamcop.net> wrote: > dfeustel@mindspring.com wrote in news:vCmog.6030$il.4542@trnddc03: > >> When the following construct is processed by ksh >> running on OpenBSD 3.9 release (cd), a CR is left >> appended to the end of $REPLY. >> ... >> Is this the expected behavior of ksh? >> (My 1989 version of _The Kornshell says that the >> newline is removed). > > CR (ascii 13) != newline (ascii 10) > > "Only" space, tab and newline are in $IFS > > That the tty line disipline usually converts CR input from keyboard to NL > (stty icrnl) doesn't matter for files What happens when the arguments are written to the console is that any output following the argument with the appended CR is printed starting at column 1, overwriting the data previously written to the line. Definitely not the output appearance that I was expecting. -- Using OpenBSD with or without X & KDE? http://dfeustel.home.mindspring.com |
| ||||
| dfeustel@mindspring.com wrote: > "Peter Str?mberg" <wilfried@spamcop.net> wrote: >> dfeustel@mindspring.com wrote in news:vCmog.6030$il.4542@trnddc03: >> >>> When the following construct is processed by ksh >>> running on OpenBSD 3.9 release (cd), a CR is left >>> appended to the end of $REPLY. >>> ... >>> Is this the expected behavior of ksh? >>> (My 1989 version of _The Kornshell says that the >>> newline is removed). >> >> CR (ascii 13) != newline (ascii 10) >> >> "Only" space, tab and newline are in $IFS >> >> That the tty line disipline usually converts CR input from keyboard to NL >> (stty icrnl) doesn't matter for files > > What happens when the arguments are written to the console is that any > output following the argument with the appended CR is printed starting > at column 1, overwriting the data previously written to the line. > Definitely not the output appearance that I was expecting. It looks like the simplest way to deal with this problem is to insert a tr "\r" "\n" command in an appropriate place in any data pipe where the \r character is a problem. -- Using OpenBSD with or without X & KDE? http://dfeustel.home.mindspring.com |