Thread View: gnu.bash.bug
1 messages
1 total messages
Started by hhe
Sun, 14 Jan 1990 18:01
read builting bash/sh mismatch
Author: hhe
Date: Sun, 14 Jan 1990 18:01
Date: Sun, 14 Jan 1990 18:01
30 lines
1294 bytes
1294 bytes
There seems to be a mismatch between the bash 1.04 and Sun/Ultrix sh read builtin. When assigning leftover words to the last vari- able, bash converts multiple whitespace chars to a single space while at least Sun and Ultrix sh doesn't (the sh manpage doesn't say anything about what it does with whitespace. Sh strips of trailing whitespace.) bash$ echo $BASH_VERSION 1.04.8 bash$ cat ./mismatch IFS=' ' # IFS=space tab newline, the foo bar line has got trailing whitespace read testing << _END_ foo bar _END_ echo ":$testing:" bash$ bash ./mismatch :foo bar: bash$ sh ./mismatch :foo bar: bash$ Bash calls list_string(input_line, ifs_chars, ..) to separate the words on the input line (and remove whitespace) before assigning them to variables, while sh apparently parses the input line unmodified. Hans Henrik Eriksen (hhe@ifi.uio.no) University of Oslo
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