Thread View: net.bugs
1 messages
1 total messages
Started by Tim Pointing
Wed, 09 May 1984 14:14
"read" bug in sh (v7 and 4.2)
Author: Tim Pointing
Date: Wed, 09 May 1984 14:14
Date: Wed, 09 May 1984 14:14
31 lines
1645 bytes
1645 bytes
There is an inconsistancy between the documentation for the "read" command
and its actual functioning. The documentation states "succesive words of
the input are assigned to the variables name ...". If the input to a "read"
command has multiple-blanks in a row (e.g. the output from "date" before
the 10'th of the month), then variables corresponding to the second and
following blanks are set to null. I.e. "read" is taking blanks (actually
any IFS character) to mean "that's the end of another word, on to the next";
when multiple blanks are input, corresponding variable get set to null.
Since "words" are supposed to be blank-delimited strings, multiple blanks
should be compressed to single blanks.
The bug is in the "readvar" routine in name.c (one of the least cryptic
source files) but I don't have the time available to try to fix it.
Example:
$ read a b c
this is text
$ echo $a
this
$ echo $b
$ echo $c
is text
Should this bug be fixed, or have some people used this misfeature in
shell programs?
--
Tim Pointing, DCIEM
{allegra,ubc-vision,linus,ihnp4,uw-beaver,floyd}!utcsrgv!dciem!tim
or {allegra,ihnp4,linus,decvax}!utzoo!dciem!tim
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads