Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: variable expanding to `*` matches a literal `*` in case cond. construct



On 15 Dec 2019, at 06:50, Oğuz <oguzismailuysal@xxxxxxxxx> wrote:
> 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.

Not to pile on, but, just to be clear, since a lot of people still seem
confused on this point, or at least they're imagining unlikely scenarios:

Apple have changed their default *log-in shell* to zsh. /bin/sh is still
/bin/bash (though it seems like they might switch to dash in the future?), and
both of those still work exactly the way they did before. You still need to go
out of your way to write scripts that run under zsh. Even if you use zsh to
run a shell script without an interpreter directive, it will run it with
/bin/sh.

It's true that commands you copy and paste into your shell from the Internet
may not work if they use certain bashisms or (probably ill-conceived) features
of POSIX sh, but

(a) in my experience it's very rare that you're asked to interactively enter
    commands that make use of features that differ between zsh and bash/sh
    (i certainly don't see case/esac used much on the command line),

(b) it was *always* the case that those commands might not work on any given
    machine — the person giving the command has no idea if whoever they're
    instructing is using tcsh or fish or anything else, they can't just assume
    that it's bash or even Bourne-like.

On 15 Dec 2019, at 06:50, Oğuz <oguzismailuysal@xxxxxxxxx> wrote:
> 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.

I think this was added in zsh 5.5, which was released a little too late to
get added to Bionic. Eoan and Focal are currently up-to-date.

dana



Messages sorted by: Reverse Date, Date, Thread, Author