zsh-users
 help / color / mirror / code / Atom feed
From: Dominik Vogt <dominik.vogt@gmx.de>
To: zsh-users@zsh.org
Subject: Re: variable expanding to `*` matches a literal `*` in case cond. construct
Date: Mon, 16 Dec 2019 00:27:31 +0100	[thread overview]
Message-ID: <20191215232731.m3fzzitvyfl4fkeu@gmx.de> (raw)
In-Reply-To: <CAH7i3LqVR3NqLLQng3QE=X8bPGztTmziOcwUf_9CCOqUiGQcyg@mail.gmail.com>

On Sun, Dec 15, 2019 at 03:50:20PM +0300, O??uz wrote:
> On Sun, Dec 15, 2019 at 3:02 PM Andreas Kusalananda Kähäri <
> andreas.kahari@abc.se> 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. That's my concern, maybe I'm wrong,
> I don't know.

These features are why we "experienced users" prefer zsh.  If it
worked exactly like the Posix shell, what would be the point in
using zsh?

> > 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.

What you normally need are not scripts compatible with every
shell, but *portable* scripts that run on any system.  Your best
bet ist to put

 #!/bin/sh
 (or /bin/bash for bash based systems; Linux etc.)

at the beginning of the script and make it executable. The manual
of autoconf has a chapter about writing portable shell scripts.

  https://www.gnu.org/software/autoconf/manual/autoconf-2.64/html_node/Portable-Shell.html

I recommend to read it, it lists many differences between shells
and is really helpful if you ever write software that must compile
on many systems.

> > 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.

What is actually the point in feeding scripts that have been
written for one shell to another?  Posix shells have (by
specification) some bugs that make scripting harder than
necessary.  Zsh replaces these bugs with sensible behaviour that
makes writing complex scripts for zsh much easier than for the
Posix shell, bash and others.

Some of zsh's strength are:

 + Powerful interactive mode
 + Advanced scripting

but if you're looking for something that works everywhere, /bin/sh
or /bin/bash is the better choice.

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt

  parent reply	other threads:[~2019-12-15 23:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-15  8:41 Oğuz
2019-12-15 10:05 ` Andreas Kusalananda Kähäri
2019-12-15 11:04   ` Oğuz
2019-12-15 12:02     ` Andreas Kusalananda Kähäri
2019-12-15 12:50       ` Oğuz
2019-12-15 22:49         ` Eric Cook
2019-12-15 23:27         ` Dominik Vogt [this message]
2019-12-16  0:02           ` Perry Smith
2019-12-16  0:03         ` dana
2019-12-16  0:23           ` Oğuz
2019-12-16  0:28             ` Mikael Magnusson
2019-12-16  5:25             ` Lewis Butler

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=20191215232731.m3fzzitvyfl4fkeu@gmx.de \
    --to=dominik.vogt@gmx.de \
    --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).