Re: Which shell and how to get started handling arguments

Liste des GroupesRevenir à cu shell 
Sujet : Re: Which shell and how to get started handling arguments
De : gazelle (at) *nospam* shell.xmission.com (Kenny McCormack)
Groupes : comp.unix.shell
Date : 15. Apr 2024, 18:38:34
Autres entêtes
Organisation : The official candy of the new Millennium
Message-ID : <uvjomq$3qo86$1@news.xmission.com>
References : 1 2 3
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <slrnv1qib9.1f89.naddy@lorvorc.mips.inka.de>,
Christian Weisgerber  <naddy@mips.inka.de> wrote:
On 2024-04-15, Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
>
As others have said, write your script to the POSIX shell language
standards.
>
Then, there is getopts (which is /not/ a universally-supported extension
to the shell language),
>
It is part of POSIX sh.

It would be useful to know exactly *why* OP wants to stay "as portable as
possible".  Yes, I know it is against the creed here to question such
things, but it needs to be done, nevertheless.

I say this as someone who does occasionally program in dash (Debian's
version of the "POSIX shell" paradigm), just to see and to remind myself
about how limited it is.  But I would urge OP to think long and hard about
whether or not it matters.  I find that when I do program in dash, I rather
quickly run into the limitations and end up regretting the choice.

For example, many things exist in both bash (my preferred shell programming
language, just in case such had not been made clear by now) and in "POSIX"
shell, but have limited functionality in the POSIX version.  So, if you are
used to the full functionality you get in the bash version, you can get
bitten if you assume that the "POSIX" version has the same functionality.
I mention this specifically because you mentioned "getopts" - which does
indeed exist in both bash and dash, but I'd be willing to bet, has limited
functionality in the dash version.  I never use "getopts", so I don't know
this for a fact; I am just speculating.  I know it *is* true for some other
shell commands/functions.

In general, I just don't find it worth the bother to limit myself to a
crippled shell.

But, mind you, it is possible, though unlikely, that OP actually has a
good/valid reason for doing so.  Mostly, I think it is just virtue
signalling.

--
When I was growing up we called them "retards", but that's not PC anymore.
Now, we just call them "Trump Voters".

The question is, of course, how much longer it will be until that term is also un-PC.

Date Sujet#  Auteur
15 Apr 24 * Which shell and how to get started handling arguments26James Harris
15 Apr 24 +* Re: Which shell and how to get started handling arguments2Janis Papanagnou
15 Apr 24 i`- Re: Which shell and how to get started handling arguments1Janis Papanagnou
15 Apr 24 +* Re: Which shell and how to get started handling arguments4Christian Weisgerber
15 Apr 24 i`* Re: Which shell and how to get started handling arguments3Helmut Waitzmann
16 Apr 24 i `* Re: Which shell and how to get started handling arguments2Kaz Kylheku
16 Apr 24 i  `- Re: Which shell and how to get started handling arguments1Helmut Waitzmann
15 Apr 24 +- Re: Which shell and how to get started handling arguments1Ben Bacarisse
15 Apr 24 +* Re: Which shell and how to get started handling arguments16Lew Pitcher
15 Apr 24 i+* Re: Which shell and how to get started handling arguments4Christian Weisgerber
15 Apr 24 ii+* Re: Which shell and how to get started handling arguments2Kenny McCormack
15 Apr 24 iii`- Re: Which shell and how to get started handling arguments1Kaz Kylheku
15 Apr 24 ii`- Re: Which shell and how to get started handling arguments1Lew Pitcher
15 Apr 24 i`* Re: Which shell and how to get started handling arguments11Keith Thompson
16 Apr 24 i +- Re: Which shell and how to get started handling arguments1Janis Papanagnou
16 Apr 24 i `* Re: Which shell and how to get started handling arguments9Christian Weisgerber
16 Apr 24 i  +* Re: Which shell and how to get started handling arguments3Keith Thompson
16 Apr 24 i  i`* Re: Which shell and how to get started handling arguments2Kenny McCormack
16 Apr 24 i  i `- Re: Which shell and how to get started handling arguments1Christian Weisgerber
16 Apr 24 i  +* Re: Which shell and how to get started handling arguments2Kaz Kylheku
17 Apr 24 i  i`- Re: Which shell and how to get started handling arguments1Keith Thompson
17 Apr 24 i  `* Re: Which shell and how to get started handling arguments3Lawrence D'Oliveiro
17 Apr 24 i   +- Re: Which shell and how to get started handling arguments1Kenny McCormack
17 Apr 24 i   `- Re: Which shell and how to get started handling arguments1Christian Weisgerber
15 Apr 24 +- Re: Which shell and how to get started handling arguments1Helmut Waitzmann
16 Apr 24 `- Re: Which shell and how to get started handling arguments1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal