Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: variable expanding to `*` matches a literal `*` in case cond. construct
On Sun, Dec 15, 2019 at 3:02 PM Andreas Kusalananda Kähäri <
andreas.kahari@xxxxxx> wrote:
>
> The fact that zsh does not (by default) perform splitting nor globbing
> on unquoted variables is a well known feature of this shell and one of
> the things that sets it apart from more conventional POSIX-like shells
> like bash or ksh.
>
>
Well-known by experienced users. Since MacOS switched to zsh, and MacOS's
userbase mostly consists of people who have no idea what they're doing when
it comes to command line; I think it's not unreasonable to expect them to
complain about how shell scripts/commands they find on the internet doesn't
work on their precious cheese graters. That's my concern, maybe I'm wrong,
I don't know.
> Wanting to write scripts that "works with any shell" is IMHO a
> misdirected efforti (why would you want to run code written for one
> language with the interpreter for another?).
I agree with that, but still, most shells out there are compatible with
each other to some extent. I just expected zsh too to be so.
However, since this is
> something that people seems to want to do, zsh provides emulation of sh:
>
$ zsh --emulate sh -c 'case foo in $1) echo match; esac' sh '*'
> match
>
> See the "emulate" built-in utility in the zshbuiltins(1) manual.
>
I guess this is a new feature. The latest version available on Ubuntu 18.04
repo doesn't have such an option as `--emulate`, you need to call `emulate`
from within the script; which is even worse.
Once again, I'm dissapointed with and somewhat annoyed by zsh.
Thanks again.
--
Oğuz
Messages sorted by:
Reverse Date,
Date,
Thread,
Author