zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Avery Pennarun <apenwarr@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: zsh in sh compatibility mode splits IFS slightly differently from other shells
Date: Wed, 24 Jul 2019 09:30:12 -0700	[thread overview]
Message-ID: <CAH+w=7bu4rDX_BGd8+pm4OgZR0Z3Yo2QjjF41AaRZSVB8N2n7w@mail.gmail.com> (raw)
In-Reply-To: <CAHqTa-08MY4FxwwKGFFODwsP6pZMZ1wHqM4mb-POtT7cekoBhQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 847 bytes --]

On Wed, Jul 24, 2019, 1:03 AM Avery Pennarun <apenwarr@gmail.com> 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
>

      reply	other threads:[~2019-07-25  0:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24  8:02 Avery Pennarun
2019-07-24 16:30 ` Bart Schaefer [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='CAH+w=7bu4rDX_BGd8+pm4OgZR0Z3Yo2QjjF41AaRZSVB8N2n7w@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=apenwarr@gmail.com \
    --cc=zsh-users@zsh.org \
    /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).