Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: IFS problem
- X-seq: zsh-workers 974
- From: Zefram <A.Main@xxxxxxxxxxxxxxxxx>
- To: guillaum@xxxxxxxxxxxxxx (Florent Guillaume)
- Subject: Re: IFS problem
- Date: Tue, 30 Apr 1996 18:19:07 +0100 (BST)
- Cc: zsh-workers@xxxxxxxxxxxxxxx
- In-reply-to: <199604301551.RAA19638@xxxxxxxxxxxxxx> from "Florent Guillaume" at Apr 30, 96 05:51:07 pm
> var="a%b%c"
> OIFS=$IFS
> IFS='%'; set - $var; IFS=$OIFS
> echo $#
>
>returns 3 under sh, ksh, bash 1.14.3
>but 1 under zsh 2.6.beta15
>
>Is it a known bug ?
No, it's a known feature. It's discussed in the FAQ.
By default, zsh does not perform field splitting (which IFS is used
for). To get standard Bourne/Korn/POSIX shell behaviour, use `setopt
sh_word_split`. (That option, by the way, is misnamed -- word
splitting is something else entirely.) To get field splitting on a
case-by-case basis, use "$=var" instead of "$var". "$==var" can also
be used to *dis*able field splitting for one substitution only.
For example:
var="a%b%c"
OIFS=$IFS
IFS='%'; set - $=var; IFS=$OIFS
echo $#
-zefram
Messages sorted by:
Reverse Date,
Date,
Thread,
Author