Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Feb 1997 01:00:01 -0800 (PST)
From:      j@uriah.heep.sax.de (J Wunsch)
To:        freebsd-bugs
Subject:   Re: bin/2803: /bin/sh 'for' statement vs IFS setting problem
Message-ID:  <199702230900.BAA29258@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/2803; it has been noted by GNATS.

From: j@uriah.heep.sax.de (J Wunsch)
To: mpp@freefall.freebsd.org (Mike Pritchard)
Cc: FreeBSD-gnats-submit@freefall.freebsd.org, Scott.Blachowicz@seaslug.org
Subject: Re: bin/2803: /bin/sh 'for' statement vs IFS setting problem
Date: Sun, 23 Feb 1997 09:33:20 +0100

 As Mike Pritchard wrote:
 
 >  > >How-To-Repeat:
 >  > 
 >  > 	I use this test script:
 >  > 
 >  > 		#! /bin/sh
 >  > 		IFS=' :'
 >  > 		for tok in a:b:c
 >  > 		do
 >  > 		    echo $tok
 >  > 		done
 >  > 		for tok in d e f
 >  > 		do
 >  > 		    echo $tok
 >  > 		done
 >  > 
 >  > 	which SHOULD output 6 lines of output (letters a-f on separate
 >  > 	lines), but what comes out is this:
 >  > 
 >  > 		a b c
 >  > 		d
 >  > 		e
 >  > 		f
 
 >  3)
 >  	IFS=' :'
 >  	xxx=a:b:C
 >  	for tok in $xxx
 >  	do
 >  		echo $tok
 >  	done
 >  
 >  For the record, under 3.0, every shell I tried, ksh, sh and bash
 >  all work this way.  Does this work the same way on other operating
 >  systems?  E.g. Sunos/Solaris, or some other SYSv variety?
 
 $ echo ${.sh.version}
 Version M-12/28/93e
 $ for tok in a:b:c       
 > do 
 >     echo $tok
 > done
 a b c
 $ 
 
 That's ksh93, the genuine Korn shell.  Since this is `by definition'
 also the Posix shell, i think we can close the case.
 
 -- 
 cheers, J"org
 
 joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
 Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702230900.BAA29258>