zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <A.Main@dcs.warwick.ac.uk>
To: guillaum@clipper.ens.fr (Florent Guillaume)
Cc: zsh-workers@math.gatech.edu
Subject: Re: IFS problem
Date: Tue, 30 Apr 1996 18:19:07 +0100 (BST)	[thread overview]
Message-ID: <21648.199604301719@stone.dcs.warwick.ac.uk> (raw)
In-Reply-To: <199604301551.RAA19638@clipper.ens.fr> 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



      reply	other threads:[~1996-04-30 17:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-30 15:51 Florent Guillaume
1996-04-30 17:19 ` Zefram [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=21648.199604301719@stone.dcs.warwick.ac.uk \
    --to=a.main@dcs.warwick.ac.uk \
    --cc=guillaum@clipper.ens.fr \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).