Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh in sh compatibility mode splits IFS slightly differently from other shells
- X-seq: zsh-users 24095
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Avery Pennarun <apenwarr@xxxxxxxxx>
- Subject: Re: zsh in sh compatibility mode splits IFS slightly differently from other shells
- Date: Wed, 24 Jul 2019 09:30:12 -0700
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wX87x4eWNLCZcHGj/afBKmhjnE8aDvHgKpkKbGbbQiU=; b=zba1IeWoEHgwja1ROMkGn4gbkScj/A6srMWyomw99u29GPU8NXWwSViHAJ31DXzxnK rkkgvbVPwlO2XhA3zRDOEPfXo7NySTe6SFoT/D9brjc5lNCR6c6JZOU0M8v+9fV9XdFX WcoP9cWYTp/lgqaWD/adNbVNKWv3XbcRLLRbIVVuyeEfSZYtJDfgdscpvhI+Is1b29kA CkIFbMgz4oKddQdmBPd956Ws9+GFvidgj+vSnRuYmF3M9SO3lI7QYhVqnfAMK4rIuRFa 5pzToVtxbDzXJeMA1OrYFPeZfd47OkjM8Cz4FbALZwuPX+b5vea4UIRT/rHwzJjuiC/e xuXQ==
- In-reply-to: <CAHqTa-08MY4FxwwKGFFODwsP6pZMZ1wHqM4mb-POtT7cekoBhQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAHqTa-08MY4FxwwKGFFODwsP6pZMZ1wHqM4mb-POtT7cekoBhQ@mail.gmail.com>
On Wed, Jul 24, 2019, 1:03 AM Avery Pennarun <apenwarr@xxxxxxxxx> wrote:
> Hi all,
>
> I think this may be a known bug, as you can see it documented here:
> https://www.in-ulm.de/~mascheck/various/ifs/
>
> However, it bit users of one of my scripts lately
> (https://github.com/apenwarr/redo/blob/master/minimal/do) because it
> was accidentally depending on the non-sh behaviour.
>
> Simple test:
>
> emulate sh
> x="/a/b/c/"
> IFS=/
> f() {
> echo "$2" "$#"
> }
> f $x
>
> On zsh, this prints:
> a 5
>
> on bash, dash, mksh, ksh93, and posh (at least), this prints:
> a 4
>
> I've already worked around the problem in my script, but it would be
> nice if nobody ever has to experience this again. Would it be possible
> to change zsh to match other shells' behaviour, at least when in sh
> compatibility mode?
>
> Thanks,
>
> Avery
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author