* Re: variable expanding to `*` matches a literal `*` in case cond. construct
2019-12-15 12:50 ` Oğuz
@ 2019-12-15 22:49 ` Eric Cook
2019-12-15 23:27 ` Dominik Vogt
2019-12-16 0:03 ` dana
2 siblings, 0 replies; 12+ messages in thread
From: Eric Cook @ 2019-12-15 22:49 UTC (permalink / raw)
To: zsh-users
On 12/15/19 7:50 AM, Oğuz wrote:
> Well-known by experienced users.
and non-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.
That falls on your vendor's hands. forcing a program onto you without educating you about it.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: variable expanding to `*` matches a literal `*` in case cond. construct
2019-12-15 12:50 ` Oğuz
2019-12-15 22:49 ` Eric Cook
@ 2019-12-15 23:27 ` Dominik Vogt
2019-12-16 0:02 ` Perry Smith
2019-12-16 0:03 ` dana
2 siblings, 1 reply; 12+ messages in thread
From: Dominik Vogt @ 2019-12-15 23:27 UTC (permalink / raw)
To: zsh-users
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: variable expanding to `*` matches a literal `*` in case cond. construct
2019-12-15 23:27 ` Dominik Vogt
@ 2019-12-16 0:02 ` Perry Smith
0 siblings, 0 replies; 12+ messages in thread
From: Perry Smith @ 2019-12-16 0:02 UTC (permalink / raw)
To: Zsh Users
[-- Attachment #1: Type: text/plain, Size: 801 bytes --]
> On Dec 15, 2019, at 5:27 PM, Dominik Vogt <dominik.vogt@gmx.de> wrote:
>
> 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.)
Also, if you don’t put #!, the script is executed by “sh” — not
$SHELL
% cat /tmp/simple
ps -p$$
(note there is no #!)
% /tmp/simple
PID TTY TIME CMD
24317 ttys000 0:00.01 sh /tmp/simple
note it is “sh” not zsh running the script
Also, zsh is only the default shell on MacOS for new users. Existing
users, after an upgrade, still use the same shell as they did before
(this is according to the documentation which I’ve not verified).
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2966 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: variable expanding to `*` matches a literal `*` in case cond. construct
2019-12-15 12:50 ` Oğuz
2019-12-15 22:49 ` Eric Cook
2019-12-15 23:27 ` Dominik Vogt
@ 2019-12-16 0:03 ` dana
2019-12-16 0:23 ` Oğuz
2 siblings, 1 reply; 12+ messages in thread
From: dana @ 2019-12-16 0:03 UTC (permalink / raw)
To: Oğuz; +Cc: andreas.kahari, Zsh Users
On 15 Dec 2019, at 06:50, Oğuz <oguzismailuysal@gmail.com> 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@gmail.com> 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: variable expanding to `*` matches a literal `*` in case cond. construct
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
0 siblings, 2 replies; 12+ messages in thread
From: Oğuz @ 2019-12-16 0:23 UTC (permalink / raw)
To: dana; +Cc: Zsh Users
[-- Attachment #1: Type: text/plain, Size: 827 bytes --]
16 Aralık 2019 Pazartesi tarihinde dana <dana@dana.is> yazdı:
>
> 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.
>
Thanks, this is something I didn't know. So the conclusion is;
1. One should never, ever expect zsh to be compatible with other shells
since it has to suck, just as its users,
2. Apple doesn't force zsh, and a proper shell is still available, so no
need to worry.
This is my last post to this mailing list, thanks.
--
Oğuz
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: variable expanding to `*` matches a literal `*` in case cond. construct
2019-12-16 0:23 ` Oğuz
@ 2019-12-16 0:28 ` Mikael Magnusson
2019-12-16 5:25 ` Lewis Butler
1 sibling, 0 replies; 12+ messages in thread
From: Mikael Magnusson @ 2019-12-16 0:28 UTC (permalink / raw)
To: Oğuz; +Cc: dana, Zsh Users
On 12/16/19, Oğuz <oguzismailuysal@gmail.com> wrote:
> 16 Aralık 2019 Pazartesi tarihinde dana <dana@dana.is> yazdı:
>>
>> 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.
>>
>
> Thanks, this is something I didn't know. So the conclusion is;
> 1. One should never, ever expect zsh to be compatible with other shells
> since it has to suck, just as its users,
> 2. Apple doesn't force zsh, and a proper shell is still available, so no
> need to worry.
>
> This is my last post to this mailing list, thanks.
If all shells worked exactly the same, what would be the purpose of
having more than one to choose from? Zsh doesn't fall into the same
traps of traditional sh like bash did, and it is possible to write
working scripts without using horribly convoluted constructs. If you
think that "sucks", that is your loss. Looking forward to not getting
a reply to this since you've already sent your last post to this
mailing list, you're welcome.
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: variable expanding to `*` matches a literal `*` in case cond. construct
2019-12-16 0:23 ` Oğuz
2019-12-16 0:28 ` Mikael Magnusson
@ 2019-12-16 5:25 ` Lewis Butler
1 sibling, 0 replies; 12+ messages in thread
From: Lewis Butler @ 2019-12-16 5:25 UTC (permalink / raw)
To: Zsh Users
On 15 Dec 2019, at 17:23, Oğuz <oguzismailuysal@gmail.com> wrote:
> This is my last post to this mailing list, thanks.
<https://www.youtube.com/watch?v=W7gnpmOWBKo>
--
ɹןʇnqן
<mailto:lbutler@covisp.net>
tel:+1.303.219.0564
^ permalink raw reply [flat|nested] 12+ messages in thread