🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #832

read builting bash/sh mismatch

#832
From: hhe
Date: Sun, 14 Jan 1990 18:01
30 lines
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
Technical Details
Message-ID: <9001141801.AA01367@helblinde.uio.no>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!IFI.UIO.NO!hhe

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!IFI.UIO.NO!hhe
From: hhe@IFI.UIO.NO
Newsgroups: gnu.bash.bug
Subject: read builting bash/sh mismatch
Message-ID: <9001141801.AA01367@helblinde.uio.no>
Date: 14 Jan 90 18:01:23 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 30