* IFS problem
@ 1996-04-30 15:51 Florent Guillaume
1996-04-30 17:19 ` Zefram
0 siblings, 1 reply; 2+ messages in thread
From: Florent Guillaume @ 1996-04-30 15:51 UTC (permalink / raw)
To: zsh-workers
I have a problem with IFS :
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 ?
-- Florent
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: IFS problem
1996-04-30 15:51 IFS problem Florent Guillaume
@ 1996-04-30 17:19 ` Zefram
0 siblings, 0 replies; 2+ messages in thread
From: Zefram @ 1996-04-30 17:19 UTC (permalink / raw)
To: Florent Guillaume; +Cc: zsh-workers
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1996-04-30 17:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-04-30 15:51 IFS problem Florent Guillaume
1996-04-30 17:19 ` Zefram
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).