Subject: bin/809: If you alter $IFS in sh it breaks
To: None <gnats-admin@NetBSD.ORG>
From: None <sh391@city.ac.uk>
List: netbsd-bugs
Date: 02/20/1995 10:35:03
>Number: 809
>Category: bin
>Synopsis: If you alter $IFS in sh it breaks
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Feb 20 10:35:01 1995
>Originator: David Brownlee
>Organization:
Private
>Release: Feb-95
>Environment:
sparc, 1.0A, current
System: NetBSD gluon.city.ac.uk 1.0A NetBSD 1.0A (GLUON) #1: Thu Feb 9 11:25:40 GMT 1995 monoadm@gluon.city.ac.uk:/mono/u1/NetBSD/src/sys/arch/sparc/compile/GLUON sparc
>Description:
If you add : to the start of IFS then shell no longer treats multiple
blanks correctly - it splits out empty arguments between each blank.
>How-To-Repeat:
Run the following script - & watch the blank line between a & b on the
'changed IFS' run.
#!/bin/sh
list="a b c "
echo "With ordinary IFS"
for i in $list;do
echo $i
done
IFS=":${IFS}"
echo "With changed IFS"
for i in $list;do
echo $i
done
>Fix:
>Audit-Trail:
>Unformatted: