Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

I find you lack of faith in the forth dithturbing. -- Darse ("Darth") Vader


computers / comp.os.linux.misc / Stop writing shell scripts

SubjectAuthor
* Stop writing shell scriptsAndrei Z.
+* Re: Stop writing shell scriptsDavid W. Hodgins
|+* Re: Stop writing shell scriptsJohn-Paul Stewart
||`* Re: Stop writing shell scriptsJim Jackson
|| +- Re: Stop writing shell scriptsThe Natural Philosopher
|| `* Re: Stop writing shell scriptsPancho
||  +* Re: Stop writing shell scriptsGrant Taylor
||  |`* Re: Stop writing shell scriptsDavid W. Hodgins
||  | `* Re: Stop writing shell scriptsPancho
||  |  `* Re: Stop writing shell scriptsGrant Taylor
||  |   +- Re: Stop writing shell scriptsRichard Kettlewell
||  |   `- Re: Stop writing shell scriptsEli the Bearded
||  `- Re: Stop writing shell scriptsJim Jackson
|`* Re: Stop writing shell scriptsDan Espen
| +- Re: Stop writing shell scriptsGrant Taylor
| `- Re: Stop writing shell scriptsDavid W. Hodgins
+* Re: Stop writing shell scriptsGrant Taylor
|+- Re: Stop writing shell scriptsRichard Kettlewell
|`* Re: Stop writing shell scriptsGerald Gruner
| `* Re: Stop writing shell scriptsGrant Taylor
|  `* Re: Stop writing shell scriptsGerald Gruner
|   `* Re: Stop writing shell scriptsGrant Taylor
|    `- Re: Stop writing shell scriptsGerald Gruner
+- Re: Stop writing shell scriptsFenris
+* Re: Stop writing shell scriptsJens Stuckelberger
|+* Re: Stop writing shell scriptsGrant Taylor
||`* Re: Stop writing shell scriptsEli the Bearded
|| +* Re: Stop writing shell scriptsDan Espen
|| |+* Re: Stop writing shell scriptsGrant Taylor
|| ||`* Re: Stop writing shell scriptsDan Espen
|| || `* Re: Stop writing shell scriptsGrant Taylor
|| ||  `* Re: Stop writing shell scriptsThe Natural Philosopher
|| ||   `- Re: Stop writing shell scriptsGrant Taylor
|| |+- Re: Stop writing shell scriptsDavid W. Hodgins
|| |`* Re: Stop writing shell scriptsRoger Blake
|| | `* Re: Stop writing shell scripts25.BX944
|| |  `* Re: Stop writing shell scriptsComputer Nerd Kev
|| |   +* Re: Stop writing shell scriptsEli the Bearded
|| |   |`* Re: Stop writing shell scripts25.BX944
|| |   | `* Re: Stop writing shell scriptsEli the Bearded
|| |   |  `- Re: Stop writing shell scripts25.BX944
|| |   `- Re: Stop writing shell scripts25.BX944
|| `- Re: Stop writing shell scriptsJens Stuckelberger
|`- Re: Stop writing shell scriptsMarc Haber
+* Re: Stop writing shell scriptsAnssi Saari
|+- Re: Stop writing shell scriptsRichard Kettlewell
|`* Re: Stop writing shell scriptsThe Natural Philosopher
| `* Re: Stop writing shell scriptsRichard Kettlewell
|  +- Re: Stop writing shell scriptsAndrei Z.
|  `* Re: Stop writing shell scriptsGrant Taylor
|   `- Re: Stop writing shell scriptsRichard Kettlewell
`- Re: Stop writing shell scriptsMarc

Pages:123
Stop writing shell scripts

<t1sr34$127i$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7150&group=comp.os.linux.misc#7150

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!aioe.org!dHE/ChOKnoVmPICsDa8mnw.user.46.165.242.75.POSTED!not-for-mail
From: no-em...@invalid.invalid (Andrei Z.)
Newsgroups: comp.os.linux.misc
Subject: Stop writing shell scripts
Date: Mon, 28 Mar 2022 20:25:55 +0300
Organization: Aioe.org NNTP Server
Message-ID: <t1sr34$127i$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="35058"; posting-host="dHE/ChOKnoVmPICsDa8mnw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: Andrei Z. - Mon, 28 Mar 2022 17:25 UTC

"Please stop writing shell scripts"

https://pythonspeed.com/articles/shell-scripts/

"Everything works fine.

And then, one day, your shell script does something completely wrong.

That’s when you realize your mistake: bash, and shell scripting
languages in general, are mostly broken by default. Unless you are very
careful from day one, any shell script above a certain complexity level
is almost guaranteed to be buggy… and retrofitting the correctness
features is quite difficult."

Re: Stop writing shell scripts

<op.1jq5xgb1a3w0dxdave@hodgins.homeip.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7151&group=comp.os.linux.misc#7151

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 14:06:42 -0400
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <op.1jq5xgb1a3w0dxdave@hodgins.homeip.net>
References: <t1sr34$127i$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="6c13d42d7e4d036ab82d33fffc597458";
logging-data="29319"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19QoRBEq4wr/St/SGXcz7DTtFLaueqIb00="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:35xmkXf73tcqeATbwOY7u+9eGUg=
 by: David W. Hodgins - Mon, 28 Mar 2022 18:06 UTC

On Mon, 28 Mar 2022 13:25:55 -0400, Andrei Z. <no-email@invalid.invalid> wrote:
> "Please stop writing shell scripts"
>
> https://pythonspeed.com/articles/shell-scripts/
>
> "Everything works fine.
>
> And then, one day, your shell script does something completely wrong.
>
> That’s when you realize your mistake: bash, and shell scripting
> languages in general, are mostly broken by default. Unless you are very
> careful from day one, any shell script above a certain complexity level
> is almost guaranteed to be buggy… and retrofitting the correctness
> features is quite difficult."

In that case, no one should ever write computer programs, since they are too complex,
depend on other programs that may change, or hardware that users may change, or data
the programmer didn't anticipate, and suddenly go completely wrong.

Ignore the article. While it's true that a lot of computer software, including shell
scripts, are created by people who don't know enough to do it properly, that doesn't
mean software should not be created. It just means people need to learn to do things
properly. Unfortunately, most people either learn by trial and error, or not at
all, or from other people who also don't know how to do things properly. People need
to learn to only use software and information from trusted sources, or that they know
how to verify.

Regards, Dave Hodgins

Re: Stop writing shell scripts

<t1t00c$324$1@tncsrv09.home.tnetconsulting.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7152&group=comp.os.linux.misc#7152

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!tncsrv09.home.tnetconsulting.net!.POSTED.alpha.home.tnetconsulting.net!not-for-mail
From: gtay...@tnetconsulting.net (Grant Taylor)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 12:50:17 -0600
Organization: TNet Consulting
Message-ID: <t1t00c$324$1@tncsrv09.home.tnetconsulting.net>
References: <t1sr34$127i$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 28 Mar 2022 18:49:48 -0000 (UTC)
Injection-Info: tncsrv09.home.tnetconsulting.net; posting-host="alpha.home.tnetconsulting.net:198.18.18.251";
logging-data="3140"; mail-complaints-to="newsmaster@tnetconsulting.net"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
In-Reply-To: <t1sr34$127i$1@gioia.aioe.org>
Content-Language: en-US
 by: Grant Taylor - Mon, 28 Mar 2022 18:50 UTC

On 3/28/22 11:25 AM, Andrei Z. wrote:
> Everything works fine.
>
> And then, one day, your shell script does something completely wrong.
>
> That’s when you realize your mistake: bash, and shell scripting
> languages in general, are mostly broken by default. Unless you are very
> careful from day one, any shell script above a certain complexity level
> is almost guaranteed to be buggy… and retrofitting the correctness
> features is quite difficult.

You can generalize that to any form of programming, not just shell scripts.

--
Grant. . . .
unix || die

Re: Stop writing shell scripts

<jaef9dF6f49U1@mid.individual.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7153&group=comp.os.linux.misc#7153

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: jpstew...@personalprojects.net (John-Paul Stewart)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 15:06:20 -0400
Lines: 29
Message-ID: <jaef9dF6f49U1@mid.individual.net>
References: <t1sr34$127i$1@gioia.aioe.org>
<op.1jq5xgb1a3w0dxdave@hodgins.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net S2ETPfKrvRiR/4nkDliCQgOtasxNFiKBZh/THxJ50BnWd/j+9p
Cancel-Lock: sha1:wVoccMs6pd65gxMCaQM5hG8HNvE=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Content-Language: en-CA
In-Reply-To: <op.1jq5xgb1a3w0dxdave@hodgins.homeip.net>
 by: John-Paul Stewart - Mon, 28 Mar 2022 19:06 UTC

On 2022-03-28 14:06, David W. Hodgins wrote:
> On Mon, 28 Mar 2022 13:25:55 -0400, Andrei Z. <no-email@invalid.invalid>
> wrote:
>> "Please stop writing shell scripts"
>>
>> https://pythonspeed.com/articles/shell-scripts/
>
> In that case, no one should ever write computer programs, since they
> are too complex, depend on other programs that may change, or
> hardware that users may change, or data the programmer didn't
> anticipate, and suddenly go completely wrong.
>
> Ignore the article. While it's true that a lot of computer software,
> including shell scripts, are created by people who don't know enough
> to do it properly, that doesn't mean software should not be created.
> It just means people need to learn to do things properly.
I agree about ignoring the article and learning to do things properly.

Most of the examples in that article were of the form:

some_command
echo "Success"

I.e., they never once checked the exit status of the command and always
unconditionally reported success. They then used their broken examples
to claim shell scripting is bad. The article was either written by
somebody with little to no shell experience or is deliberately being
misleading. Either way, it's not worth reading.

Re: Stop writing shell scripts

<t1t1jk$tfu$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7154&group=comp.os.linux.misc#7154

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dan1es...@gmail.com (Dan Espen)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 15:17:08 -0400
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <t1t1jk$tfu$1@dont-email.me>
References: <t1sr34$127i$1@gioia.aioe.org>
<op.1jq5xgb1a3w0dxdave@hodgins.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="394ed9c14bdc167288125d931e5771f4";
logging-data="30206"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JfwQHc2+vqfQh7BB4VESfLarDy1/1nbM="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:DVqoNCDbgtmkfOF2391XrvTUkiw=
 by: Dan Espen - Mon, 28 Mar 2022 19:17 UTC

"David W. Hodgins" <dwhodgins@nomail.afraid.org> writes:

> On Mon, 28 Mar 2022 13:25:55 -0400, Andrei Z. <no-email@invalid.invalid> wrote:
>> "Please stop writing shell scripts"
>>
>> https://pythonspeed.com/articles/shell-scripts/
>>
>> "Everything works fine.
>>
>> And then, one day, your shell script does something completely wrong.
>>
>> That’s when you realize your mistake: bash, and shell scripting
>> languages in general, are mostly broken by default. Unless you are very
>> careful from day one, any shell script above a certain complexity level
>> is almost guaranteed to be buggy… and retrofitting the correctness
>> features is quite difficult."
>
> In that case, no one should ever write computer programs, since they are too complex,
> depend on other programs that may change, or hardware that users may change, or data
> the programmer didn't anticipate, and suddenly go completely wrong.

This is about choice of languages, not whether programs should be
written at all.

Back when I was still working there was more than one project in trouble
that I rescued by converting a bunch of shell/sed/awk/grep stuff into
Perl.

Now I'd use Python.

I prefer to use one language that can do everything rather than creating
a nest of multiple languages.

Every once in a while I'll create a .sh file but if there's the
slightest change the script will grow, I prefer to use a more robust
language.

--
Dan Espen

Re: Stop writing shell scripts

<t1t2t2$qrp$1@tncsrv09.home.tnetconsulting.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7155&group=comp.os.linux.misc#7155

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!tncsrv09.home.tnetconsulting.net!.POSTED.alpha.home.tnetconsulting.net!not-for-mail
From: gtay...@tnetconsulting.net (Grant Taylor)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 13:39:43 -0600
Organization: TNet Consulting
Message-ID: <t1t2t2$qrp$1@tncsrv09.home.tnetconsulting.net>
References: <t1sr34$127i$1@gioia.aioe.org>
<op.1jq5xgb1a3w0dxdave@hodgins.homeip.net> <t1t1jk$tfu$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 28 Mar 2022 19:39:14 -0000 (UTC)
Injection-Info: tncsrv09.home.tnetconsulting.net; posting-host="alpha.home.tnetconsulting.net:198.18.18.251";
logging-data="27513"; mail-complaints-to="newsmaster@tnetconsulting.net"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
In-Reply-To: <t1t1jk$tfu$1@dont-email.me>
Content-Language: en-US
 by: Grant Taylor - Mon, 28 Mar 2022 19:39 UTC

On 3/28/22 1:17 PM, Dan Espen wrote:
> Back when I was still working there was more than one project in
> trouble that I rescued by converting a bunch of shell/sed/awk/grep
> stuff into Perl.

In my experience, sed and awk are vary rarely used by themselves for
automation. They are almost always used in conjunction with something else.

I'd up-vote Perl. Many people I know would down-vote Perl.

> Now I'd use Python.

I'd definitely down-vote Python.

> I prefer to use one language that can do everything rather than
> creating a nest of multiple languages.

There is something to be said for using a /single/ language that can do
everything that's needed. But that's a question of number of languages,
not which language. Contemporary Bash and Zsh can now do many of the
things that I've seen others use sed / awk / etc. to do.

> Every once in a while I'll create a .sh file but if there's the
> slightest change the script will grow, I prefer to use a more robust
> language.

I feel like there is an unspoken subtext that I believe really should be
spoken.

There are many things that shell scripts are quite appropriate for.
There are many things that shell scripts are inappropriate for. The
biggest difference to me is the size and complexity. I find that things
that are smaller (and not likely to grow) and / or cross multiple other
things are better for shell scripts. Especially thing that would need
to shell() to run commands outside of their native language; e.g.
external executables. I think that shell is probably a poor language
for something that will be more vertically integrated. I think that
shell can be a good language when horizontally acting across multiple
things.

Aside: Remember, most init systems execute small shell scripts.
(Independent of the technology of the init system.) Said scripts are
small and written specifically to do a small number of things (start,
stop, restart, status, etc.) with a singular entity.

--
Grant. . . .
unix || die

Re: Stop writing shell scripts

<op.1jq9rbgsa3w0dxdave@hodgins.homeip.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7156&group=comp.os.linux.misc#7156

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 15:29:25 -0400
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <op.1jq9rbgsa3w0dxdave@hodgins.homeip.net>
References: <t1sr34$127i$1@gioia.aioe.org>
<op.1jq5xgb1a3w0dxdave@hodgins.homeip.net> <t1t1jk$tfu$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="6c13d42d7e4d036ab82d33fffc597458";
logging-data="18806"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19r/9/Vu/sO8OE7AgA6xy02jrPCsAiXFmA="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:61XfnsJxdgKiSzO9XLMZchj3j00=
 by: David W. Hodgins - Mon, 28 Mar 2022 19:29 UTC

On Mon, 28 Mar 2022 15:17:08 -0400, Dan Espen <dan1espen@gmail.com> wrote:
> I prefer to use one language that can do everything rather than creating
> a nest of multiple languages.

Every programmer has their own preferences. Having different preferences is about
choice, not what is right or wrong.

> Every once in a while I'll create a .sh file but if there's the
> slightest change the script will grow, I prefer to use a more robust
> language.

Using the right tool for the job is important. A hammer may be used to put in a
wood screw, but that won't last and is not the right tool.

Shell scripts have their uses, as do other programming languages. I've seen lots
of badly written python scripts, as well as bash scripts. Any language takes
education to learn to use properly. Putting out a statement "Stop writing shell
scripts", is just click bait, not a valid or remotely useful instruction.

Regards, Dave Hodgins

Re: Stop writing shell scripts

<87wngdu9h7.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7157&group=comp.os.linux.misc#7157

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!aioe.org!nntp.terraraq.uk!.POSTED.nntp.terraraq.uk!not-for-mail
From: inva...@invalid.invalid (Richard Kettlewell)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 21:07:32 +0100
Organization: terraraq NNTP server
Message-ID: <87wngdu9h7.fsf@LkoBDZeT.terraraq.uk>
References: <t1sr34$127i$1@gioia.aioe.org>
<t1t00c$324$1@tncsrv09.home.tnetconsulting.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: mantic.terraraq.uk; posting-host="nntp.terraraq.uk:2a00:1098:0:86:1000:3f:0:2";
logging-data="19205"; mail-complaints-to="usenet@mantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:yuVjz6zBdB8suY/JQytgjU/VGpU=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Mon, 28 Mar 2022 20:07 UTC

Grant Taylor <gtaylor@tnetconsulting.net> writes:
> On 3/28/22 11:25 AM, Andrei Z. wrote:
>> Everything works fine.
>> And then, one day, your shell script does something completely
>> wrong.
>> That’s when you realize your mistake: bash, and shell scripting
>> languages in general, are mostly broken by default. Unless you are
>> very careful from day one, any shell script above a certain
>> complexity level is almost guaranteed to be buggy… and retrofitting
>> the correctness features is quite difficult.
>
> You can generalize that to any form of programming, not just shell scripts.

That would be missing the point, which is that shell is especially bad
as a programming language. I agree, for the reasons given in the
article.

--
https://www.greenend.org.uk/rjk/

Re: Stop writing shell scripts

<1d8cl70pxxh6l$.dlg@10235314.user.individual.de>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7158&group=comp.os.linux.misc#7158

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: gerald...@yahoo.de (Gerald Gruner)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 22:21:45 +0200
Organization: -
Lines: 25
Message-ID: <1d8cl70pxxh6l$.dlg@10235314.user.individual.de>
References: <t1sr34$127i$1@gioia.aioe.org> <t1t00c$324$1@tncsrv09.home.tnetconsulting.net>
Mime-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
X-Trace: individual.net uIZuU6WjrVdn0U+pm6S+DgeNop5wOo+VFpjLJU2RvRpX3+3y1g
Cancel-Lock: sha1:fG3gngZf/vsXmBbBtVGc0GPbmJA=
User-Agent: 40tude_Dialog/2.0.15.41de
 by: Gerald Gruner - Mon, 28 Mar 2022 20:21 UTC

Grant Taylor schrieb am 28.03.22:

> On 3/28/22 11:25 AM, Andrei Z. wrote:
>> Everything works fine.
>>
>> And then, one day, your shell script does something completely wrong.
>>
>> That’s when you realize your mistake: bash, and shell scripting
>> languages in general, are mostly broken by default. Unless you are very
>> careful from day one, any shell script above a certain complexity level
>> is almost guaranteed to be buggy… and retrofitting the correctness
>> features is quite difficult.
>
> You can generalize that to any form of programming, not just shell scripts.

With one difference: The syntax of bash shell scripts is more of a
practical joke that for some strange reasons made it to reality.

MfG
Gerald

--
Wenn ich Schokolade sehe, höre ich zwei Stimmen in mir.
Die eine sagt: "Iss sie!"
Die andere sagt: "Hast du nicht gehört? Du sollst sie essen!"

Re: Stop writing shell scripts

<Pine.NEB.4.64.2203282234220.2587@rie.sdf.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7159&group=comp.os.linux.misc#7159

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!aioe.org!0uS3IkI3e3DfmX4suNwhhQ.user.46.165.242.75.POSTED!not-for-mail
From: fen...@invalid.invalid (Fenris)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 22:41:23 +0200
Organization: Aioe.org NNTP Server
Message-ID: <Pine.NEB.4.64.2203282234220.2587@rie.sdf.org>
References: <t1sr34$127i$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Injection-Info: gioia.aioe.org; logging-data="17070"; posting-host="0uS3IkI3e3DfmX4suNwhhQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-X-Sender: fenris@rie.sdf.org
X-Notice: Filtered by postfilter v. 0.9.2
 by: Fenris - Mon, 28 Mar 2022 20:41 UTC

On Mon, 28 Mar 2022, Andrei Z. wrote:
> "Please stop writing shell scripts"
>
> https://pythonspeed.com/articles/shell-scripts/
>
> "Everything works fine.
>
> And then, one day, your shell script does something completely wrong.

The discussion overlooked one thing: The adminstration of unix

Beeing an sysadmin of several unix flavours, I can administrate
of of them with posix shell scripts.

That said, I can't program in any other language. But shell scripts are
sufficent.

Re: Stop writing shell scripts

<t1t6sl$is9$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7160&group=comp.os.linux.misc#7160

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!aioe.org!fs4vz7lwhQCwq5L3H1slGg.user.46.165.242.75.POSTED!not-for-mail
From: Jens_Stu...@nowhere.net (Jens Stuckelberger)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 20:47:17 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <t1t6sl$is9$1@gioia.aioe.org>
References: <t1sr34$127i$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="19337"; posting-host="fs4vz7lwhQCwq5L3H1slGg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Pan/0.149 (Bellevue; 4c157ba git@gitlab.gnome.org:GNOME/pan.git)
X-Notice: Filtered by postfilter v. 0.9.2
 by: Jens Stuckelberger - Mon, 28 Mar 2022 20:47 UTC

On Mon, 28 Mar 2022 20:25:55 +0300, Andrei Z. wrote:

> "Please stop writing shell scripts"
>
> https://pythonspeed.com/articles/shell-scripts/
>
> "Everything works fine.
>
> And then, one day, your shell script does something completely wrong.
>
> That’s when you realize your mistake: bash, and shell scripting
> languages in general, are mostly broken by default. Unless you are very
> careful from day one, any shell script above a certain complexity level
> is almost guaranteed to be buggy… and retrofitting the correctness
> features is quite difficult."

But, if you use python instead, everything will be peachy - you
will even get minty fresh breath round the clock.

Is that it?

Re: Stop writing shell scripts

<t1t7mf$ptg$1@tncsrv09.home.tnetconsulting.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7161&group=comp.os.linux.misc#7161

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!tncsrv09.home.tnetconsulting.net!.POSTED.alpha.home.tnetconsulting.net!not-for-mail
From: gtay...@tnetconsulting.net (Grant Taylor)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 15:01:33 -0600
Organization: TNet Consulting
Message-ID: <t1t7mf$ptg$1@tncsrv09.home.tnetconsulting.net>
References: <t1sr34$127i$1@gioia.aioe.org>
<t1t00c$324$1@tncsrv09.home.tnetconsulting.net>
<1d8cl70pxxh6l$.dlg@10235314.user.individual.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 28 Mar 2022 21:01:03 -0000 (UTC)
Injection-Info: tncsrv09.home.tnetconsulting.net; posting-host="alpha.home.tnetconsulting.net:198.18.18.251";
logging-data="26544"; mail-complaints-to="newsmaster@tnetconsulting.net"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
In-Reply-To: <1d8cl70pxxh6l$.dlg@10235314.user.individual.de>
Content-Language: en-US
 by: Grant Taylor - Mon, 28 Mar 2022 21:01 UTC

On 3/28/22 2:21 PM, Gerald Gruner wrote:
> With one difference: The syntax of bash shell scripts is more of a
> practical joke that for some strange reasons made it to reality.

Have you seen m4?

--
Grant. . . .
unix || die

Re: Stop writing shell scripts

<t1t7qu$ptg$2@tncsrv09.home.tnetconsulting.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7162&group=comp.os.linux.misc#7162

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!tncsrv09.home.tnetconsulting.net!.POSTED.alpha.home.tnetconsulting.net!not-for-mail
From: gtay...@tnetconsulting.net (Grant Taylor)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 15:03:55 -0600
Organization: TNet Consulting
Message-ID: <t1t7qu$ptg$2@tncsrv09.home.tnetconsulting.net>
References: <t1sr34$127i$1@gioia.aioe.org> <t1t6sl$is9$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 28 Mar 2022 21:03:26 -0000 (UTC)
Injection-Info: tncsrv09.home.tnetconsulting.net; posting-host="alpha.home.tnetconsulting.net:198.18.18.251";
logging-data="26544"; mail-complaints-to="newsmaster@tnetconsulting.net"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
In-Reply-To: <t1t6sl$is9$1@gioia.aioe.org>
Content-Language: en-US
 by: Grant Taylor - Mon, 28 Mar 2022 21:03 UTC

On 3/28/22 2:47 PM, Jens Stuckelberger wrote:
> But, if you use python instead, everything will be peachy

I question the veracity of that statement.

Not the least of which is systems that don't have Python installed for
one reason or another.

$DEITY help you if white space is lost through copy and pasting snafu.

I'm not aware of any single Unix (like OS) that doesn't have a shell
that will run scripts.

--
Grant. . . .
unix || die

Re: Stop writing shell scripts

<eli$2203281740@qaz.wtf>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7163&group=comp.os.linux.misc#7163

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!.POSTED.panix5.panix.com!qz!not-for-mail
From: *...@eli.users.panix.com (Eli the Bearded)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 21:40:25 -0000 (UTC)
Organization: Some absurd concept
Message-ID: <eli$2203281740@qaz.wtf>
References: <t1sr34$127i$1@gioia.aioe.org> <t1t6sl$is9$1@gioia.aioe.org> <t1t7qu$ptg$2@tncsrv09.home.tnetconsulting.net>
Injection-Date: Mon, 28 Mar 2022 21:40:25 -0000 (UTC)
Injection-Info: reader1.panix.com; posting-host="panix5.panix.com:166.84.1.5";
logging-data="25043"; mail-complaints-to="abuse@panix.com"
User-Agent: Vectrex rn 2.1 (beta)
X-Liz: It's actually happened, the entire Internet is a massive game of Redcode
X-Motto: "Erosion of rights never seems to reverse itself." -- kenny@panix
X-US-Congress: Moronic Fucks.
X-Attribution: EtB
XFrom: is a real address
Encrypted: double rot-13
 by: Eli the Bearded - Mon, 28 Mar 2022 21:40 UTC

In comp.os.linux.misc, Grant Taylor <gtaylor@tnetconsulting.net> wrote:
> On 3/28/22 2:47 PM, Jens Stuckelberger wrote:
>> But, if you use python instead, everything> will be peachy
> I question the veracity of that statement.

I read Jens' statement as sarcasm.

> Not the least of which is systems that don't have Python installed for
> one reason or another.

Not unknown but rare. Just like systems with /bin/sh but no bash exist
but are rare.

> $DEITY help you if white space is lost through copy and pasting snafu.

Yeah, I'm not a fan of python (and yaml) whitepace rules.

Elijah
------
has been working in some bare minimal alpine environs recently

Re: Stop writing shell scripts

<t1ttq4$t51$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7164&group=comp.os.linux.misc#7164

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dan1es...@gmail.com (Dan Espen)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 23:18:28 -0400
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <t1ttq4$t51$1@dont-email.me>
References: <t1sr34$127i$1@gioia.aioe.org> <t1t6sl$is9$1@gioia.aioe.org>
<t1t7qu$ptg$2@tncsrv09.home.tnetconsulting.net>
<eli$2203281740@qaz.wtf>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="5d89e048d49d2b43caba4b4e3b2d3bc6";
logging-data="29857"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19F/c7619eDuq+LtcwRNV3TXnLZUbmnVTM="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:kFN1tDgLZ6hhNndT27tzbIhCOGY=
 by: Dan Espen - Tue, 29 Mar 2022 03:18 UTC

Eli the Bearded <*@eli.users.panix.com> writes:

> In comp.os.linux.misc, Grant Taylor <gtaylor@tnetconsulting.net> wrote:
>> On 3/28/22 2:47 PM, Jens Stuckelberger wrote:
>>> But, if you use python instead, everything> will be peachy
>> I question the veracity of that statement.
>
> I read Jens' statement as sarcasm.
>
>> Not the least of which is systems that don't have Python installed for
>> one reason or another.
>
> Not unknown but rare. Just like systems with /bin/sh but no bash exist
> but are rare.

I'm just reading about these credit card size computers like the
rasberry pi. These tiny little things run linux and
are programmed in python.

I think the odds of finding bash might be slightly higher than finding
python but not significantly different.

--
Dan Espen

Re: Stop writing shell scripts

<t1u2to$di8$1@tncsrv09.home.tnetconsulting.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7165&group=comp.os.linux.misc#7165

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!tncsrv09.home.tnetconsulting.net!.POSTED.alpha.home.tnetconsulting.net!not-for-mail
From: gtay...@tnetconsulting.net (Grant Taylor)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Mon, 28 Mar 2022 22:46:14 -0600
Organization: TNet Consulting
Message-ID: <t1u2to$di8$1@tncsrv09.home.tnetconsulting.net>
References: <t1sr34$127i$1@gioia.aioe.org> <t1t6sl$is9$1@gioia.aioe.org>
<t1t7qu$ptg$2@tncsrv09.home.tnetconsulting.net> <eli$2203281740@qaz.wtf>
<t1ttq4$t51$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 29 Mar 2022 04:45:44 -0000 (UTC)
Injection-Info: tncsrv09.home.tnetconsulting.net; posting-host="alpha.home.tnetconsulting.net:198.18.18.251";
logging-data="13896"; mail-complaints-to="newsmaster@tnetconsulting.net"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
In-Reply-To: <t1ttq4$t51$1@dont-email.me>
Content-Language: en-US
 by: Grant Taylor - Tue, 29 Mar 2022 04:46 UTC

On 3/28/22 9:18 PM, Dan Espen wrote:
> I'm just reading about these credit card size computers like the
> rasberry pi. These tiny little things run linux and are programmed
> in python.

Python is one of many different languages that are available on
distributions that run on Raspberry Pis.

If it's a language that Debian provides support for, you can probably
just install it.

If it's a language that FreeBSD ports provides support for, you can
probably just ""install (compile) it.

If you have language source code, you can likely compile it on any Unix
(like) OS that runs on the Pis.

With the various architecture emulations that are available, you aren't
restricted to just what will run natively on the Raspberry Pi. Want to
emulate a PDP, go for it. Want to run Windows programs, I'm quite
confident that you can (all be it slowly). IBM mainframe OS &
associated programming languages, yep, that's an old hat trick for the
Raspberry Pi.

--
Grant. . . .
unix || die

Re: Stop writing shell scripts

<sm035j1glyb.fsf@lakka.kapsi.fi>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7166&group=comp.os.linux.misc#7166

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: as...@sci.fi (Anssi Saari)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Tue, 29 Mar 2022 12:14:04 +0300
Organization: An impatient and LOUD arachnid
Lines: 16
Message-ID: <sm035j1glyb.fsf@lakka.kapsi.fi>
References: <t1sr34$127i$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="d32807460eced617f12727afcfd0b9a9";
logging-data="20080"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3EkcmM3209V9u92uobDeu"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:ebOzGhLU9wTLtebM77iqgr0QU5g=
sha1:jZdtYgcQFzolVAeLE5DwY2TZUgo=
 by: Anssi Saari - Tue, 29 Mar 2022 09:14 UTC

"Andrei Z." <no-email@invalid.invalid> writes:

> "Please stop writing shell scripts"
>
> https://pythonspeed.com/articles/shell-scripts/
>
> "Everything works fine.

While I don't agree with the recommendation I find the article has value
in that it points out four gotchas in bash scripts and how to avoid
them, namely by starting a bash script with
set -euo pipefail. Interestingly that works as is for zsh as well.

The article even links to the "unofficial bash strict mode" which offers
some more detail as to the why and also links to Shellcheck which is
static checker for bash and sh code.

Re: Stop writing shell scripts

<87r16lt82m.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7167&group=comp.os.linux.misc#7167

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!aioe.org!nntp.terraraq.uk!.POSTED.nntp.terraraq.uk!not-for-mail
From: inva...@invalid.invalid (Richard Kettlewell)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Tue, 29 Mar 2022 10:35:29 +0100
Organization: terraraq NNTP server
Message-ID: <87r16lt82m.fsf@LkoBDZeT.terraraq.uk>
References: <t1sr34$127i$1@gioia.aioe.org> <sm035j1glyb.fsf@lakka.kapsi.fi>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: mantic.terraraq.uk; posting-host="nntp.terraraq.uk:2a00:1098:0:86:1000:3f:0:2";
logging-data="31219"; mail-complaints-to="usenet@mantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:laF4HyuDrZQ2ssMh0sEfpp2mK2I=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Tue, 29 Mar 2022 09:35 UTC

Anssi Saari <as@sci.fi> writes:
> "Andrei Z." <no-email@invalid.invalid> writes:
>> "Please stop writing shell scripts"
>>
>> https://pythonspeed.com/articles/shell-scripts/
>>
>> "Everything works fine.
>
> While I don't agree with the recommendation I find the article has value
> in that it points out four gotchas in bash scripts and how to avoid
> them, namely by starting a bash script with
> set -euo pipefail. Interestingly that works as is for zsh as well.
>
> The article even links to the "unofficial bash strict mode" which offers
> some more detail as to the why and also links to Shellcheck which is
> static checker for bash and sh code.

Not enough. See http://mywiki.wooledge.org/BashFAQ/105 for further
issues with error handling in shell.

--
https://www.greenend.org.uk/rjk/

Re: Stop writing shell scripts

<t1uqm0$4ai$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7170&group=comp.os.linux.misc#7170

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dan1es...@gmail.com (Dan Espen)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Tue, 29 Mar 2022 07:31:12 -0400
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <t1uqm0$4ai$1@dont-email.me>
References: <t1sr34$127i$1@gioia.aioe.org> <t1t6sl$is9$1@gioia.aioe.org>
<t1t7qu$ptg$2@tncsrv09.home.tnetconsulting.net>
<eli$2203281740@qaz.wtf> <t1ttq4$t51$1@dont-email.me>
<t1u2to$di8$1@tncsrv09.home.tnetconsulting.net>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="5d89e048d49d2b43caba4b4e3b2d3bc6";
logging-data="4434"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+RoKktvacMMrgXk4fV7cTiVuy8toacI9E="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:UR26J70L7XGiaFVsx8AAY2vcGJ8=
 by: Dan Espen - Tue, 29 Mar 2022 11:31 UTC

Grant Taylor <gtaylor@tnetconsulting.net> writes:

> On 3/28/22 9:18 PM, Dan Espen wrote:
>> I'm just reading about these credit card size computers like the
>> rasberry pi. These tiny little things run linux and are programmed
>> in python.
>
> Python is one of many different languages that are available on
> distributions that run on Raspberry Pis.
>
> If it's a language that Debian provides support for, you can probably
> just install it.

The stuff I've read so far shows python "import"ing a bunch of
libraries specific to the raspberry, like usb access and access to the
sensors that surround the circuit board. You don't just need the
language to work, you need access to device features. Python seems to
be the preferred language.

--
Dan Espen

Re: Stop writing shell scripts

<t1uuv1$2h5$7@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7171&group=comp.os.linux.misc#7171

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tnp...@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Tue, 29 Mar 2022 13:44:17 +0100
Organization: A little, after lunch
Lines: 31
Message-ID: <t1uuv1$2h5$7@dont-email.me>
References: <t1sr34$127i$1@gioia.aioe.org> <sm035j1glyb.fsf@lakka.kapsi.fi>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 29 Mar 2022 12:44:17 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="264e40412cc2a22ac1040aa822d83cd7";
logging-data="2597"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ekREeV5WGHae+wij3PNQ/YF23laVYFcQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:eV1LtfkLCRKbv4Fu3WATnrIJrWc=
In-Reply-To: <sm035j1glyb.fsf@lakka.kapsi.fi>
Content-Language: en-GB
 by: The Natural Philosop - Tue, 29 Mar 2022 12:44 UTC

On 29/03/2022 10:14, Anssi Saari wrote:
> "Andrei Z." <no-email@invalid.invalid> writes:
>
>> "Please stop writing shell scripts"
>>
>> https://pythonspeed.com/articles/shell-scripts/
>>
>> "Everything works fine.
>
> While I don't agree with the recommendation I find the article has value
> in that it points out four gotchas in bash scripts and how to avoid
> them, namely by starting a bash script with
> set -euo pipefail. Interestingly that works as is for zsh as well.
>
> The article even links to the "unofficial bash strict mode" which offers
> some more detail as to the why and also links to Shellcheck which is
> static checker for bash and sh code.

The problem with shell is that it looks like it started as a batch
language, and then got extended where it shouldn't orta been.

Its fine for batch stuff but even simple conditionals start making it
look ugly

--
Religion is regarded by the common people as true, by the wise as
foolish, and by the rulers as useful.

(Seneca the Younger, 65 AD)

Re: Stop writing shell scripts

<87ilrwuczx.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7172&group=comp.os.linux.misc#7172

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!aioe.org!nntp.terraraq.uk!.POSTED.nntp.terraraq.uk!not-for-mail
From: inva...@invalid.invalid (Richard Kettlewell)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Tue, 29 Mar 2022 14:03:46 +0100
Organization: terraraq NNTP server
Message-ID: <87ilrwuczx.fsf@LkoBDZeT.terraraq.uk>
References: <t1sr34$127i$1@gioia.aioe.org> <sm035j1glyb.fsf@lakka.kapsi.fi>
<t1uuv1$2h5$7@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: mantic.terraraq.uk; posting-host="nntp.terraraq.uk:2a00:1098:0:86:1000:3f:0:2";
logging-data="33791"; mail-complaints-to="usenet@mantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:dob3PDe5rdekcismD+PT06pXHU0=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Tue, 29 Mar 2022 13:03 UTC

The Natural Philosopher <tnp@invalid.invalid> writes:

> On 29/03/2022 10:14, Anssi Saari wrote:
>> "Andrei Z." <no-email@invalid.invalid> writes:
>>
>>> "Please stop writing shell scripts"
>>>
>>> https://pythonspeed.com/articles/shell-scripts/
>>>
>>> "Everything works fine.
>> While I don't agree with the recommendation I find the article has
>> value
>> in that it points out four gotchas in bash scripts and how to avoid
>> them, namely by starting a bash script with
>> set -euo pipefail. Interestingly that works as is for zsh as well.
>> The article even links to the "unofficial bash strict mode" which
>> offers
>> some more detail as to the why and also links to Shellcheck which is
>> static checker for bash and sh code.
>
> The problem with shell is that it looks like it started as a batch
> language, and then got extended where it shouldn't orta been.
>
> Its fine for batch stuff but even simple conditionals start making it
> look ugly

The half-arsed approach to error handling goes back to the start.
Acceptable for interactive use but it’s never been particularly
practical to write anything reliable in it. Like other 1970s tech it
holds on despite better options being available because reskilling and
rewriting are expensive.

--
https://www.greenend.org.uk/rjk/

Re: Stop writing shell scripts

<t1v2c1$15ib$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7173&group=comp.os.linux.misc#7173

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!aioe.org!dHE/ChOKnoVmPICsDa8mnw.user.46.165.242.75.POSTED!not-for-mail
From: no-em...@invalid.invalid (Andrei Z.)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Tue, 29 Mar 2022 16:42:25 +0300
Organization: Aioe.org NNTP Server
Message-ID: <t1v2c1$15ib$1@gioia.aioe.org>
References: <t1sr34$127i$1@gioia.aioe.org> <sm035j1glyb.fsf@lakka.kapsi.fi>
<t1uuv1$2h5$7@dont-email.me> <87ilrwuczx.fsf@LkoBDZeT.terraraq.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="38475"; posting-host="dHE/ChOKnoVmPICsDa8mnw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: Andrei Z. - Tue, 29 Mar 2022 13:42 UTC

Richard Kettlewell wrote:
> The Natural Philosopher <tnp@invalid.invalid> writes:
>
>> On 29/03/2022 10:14, Anssi Saari wrote:
>>> "Andrei Z." <no-email@invalid.invalid> writes:
>>>
>>>> "Please stop writing shell scripts"
>>>>
>>>> https://pythonspeed.com/articles/shell-scripts/
>>>>
>>>> "Everything works fine.
>>> While I don't agree with the recommendation I find the article has
>>> value
>>> in that it points out four gotchas in bash scripts and how to avoid
>>> them, namely by starting a bash script with
>>> set -euo pipefail. Interestingly that works as is for zsh as well.
>>> The article even links to the "unofficial bash strict mode" which
>>> offers
>>> some more detail as to the why and also links to Shellcheck which is
>>> static checker for bash and sh code.
>>
>> The problem with shell is that it looks like it started as a batch
>> language, and then got extended where it shouldn't orta been.
>>
>> Its fine for batch stuff but even simple conditionals start making it
>> look ugly
>
> The half-arsed approach to error handling goes back to the start.
> Acceptable for interactive use but it’s never been particularly
> practical to write anything reliable in it. Like other 1970s tech it
> holds on despite better options being available because reskilling and
> rewriting are expensive.
>
Now there are Best Practices for Bash Scripts, e.g.

https://betterprogramming.pub/best-practices-for-bash-scripts-17229889774d

Re: Stop writing shell scripts

<t1v2qc$ad61$1@news1.tnib.de>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7174&group=comp.os.linux.misc#7174

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!.POSTED.torres.zugschlus.de!not-for-mail
From: mh+usene...@zugschl.us (Marc Haber)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Tue, 29 Mar 2022 15:50:04 +0200
Organization: private site, see http://www.zugschlus.de/ for details
Message-ID: <t1v2qc$ad61$1@news1.tnib.de>
References: <t1sr34$127i$1@gioia.aioe.org> <t1t6sl$is9$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 29 Mar 2022 13:50:04 -0000 (UTC)
Injection-Info: news1.tnib.de; posting-host="torres.zugschlus.de:85.214.160.151";
logging-data="341185"; mail-complaints-to="abuse@tnib.de"
X-Newsreader: Forte Agent 6.00/32.1186
 by: Marc Haber - Tue, 29 Mar 2022 13:50 UTC

Jens Stuckelberger <Jens_Stuckelberger@nowhere.net> wrote:
>On Mon, 28 Mar 2022 20:25:55 +0300, Andrei Z. wrote:
>
>> "Please stop writing shell scripts"
>>
>> https://pythonspeed.com/articles/shell-scripts/
>>
>> "Everything works fine.
>>
>> And then, one day, your shell script does something completely wrong.
>>
>> That’s when you realize your mistake: bash, and shell scripting
>> languages in general, are mostly broken by default. Unless you are very
>> careful from day one, any shell script above a certain complexity level
>> is almost guaranteed to be buggy… and retrofitting the correctness
>> features is quite difficult."
>
> But, if you use python instead, everything will be peachy - you
>will even get minty fresh breath round the clock.

There are many automation tasks that are written as a two-liner in
shell and a twenty liner in python or any other "real" programming
language. Using command-line binaries in python and perl is often done
using an extra shell layer, which gives you another layer of quoting
hell if your work is getting any serious.

There is a niche for shell scripts, and we all would be better off if
we'd ditch shell scripts of mid level complexity in favor of "real"
programs, but sometimes (always) things evolve.

Who has never decided to rewrite a shell script in perl and got caught
by things like filename globbing or directory iteration that are
built-in in shell but need to be explicitly programmed in any other
language?

Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Mannheim, Germany | Beginning of Wisdom " |
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 621 72739834

Re: Stop writing shell scripts

<slrnt467m2.bia.jj@iridium.wf32df>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7176&group=comp.os.linux.misc#7176

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: jj...@franjam.org.uk (Jim Jackson)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Tue, 29 Mar 2022 14:59:14 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <slrnt467m2.bia.jj@iridium.wf32df>
References: <t1sr34$127i$1@gioia.aioe.org>
<op.1jq5xgb1a3w0dxdave@hodgins.homeip.net>
<jaef9dF6f49U1@mid.individual.net>
Injection-Date: Tue, 29 Mar 2022 14:59:14 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4b97dd49f39574f53dbc2586208212c6";
logging-data="21914"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1YSeMWi0F2ahbWsJzi13jQOHcUJhJQPo="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:UhCFeJDyohC2MNN+Vu41eOYk2l4=
 by: Jim Jackson - Tue, 29 Mar 2022 14:59 UTC

On 2022-03-28, John-Paul Stewart <jpstewart@personalprojects.net> wrote:
>
> On 2022-03-28 14:06, David W. Hodgins wrote:
>> On Mon, 28 Mar 2022 13:25:55 -0400, Andrei Z. <no-email@invalid.invalid>
>> wrote:
>>> "Please stop writing shell scripts"
>>>
>>> https://pythonspeed.com/articles/shell-scripts/
>>
>> In that case, no one should ever write computer programs, since they
>> are too complex, depend on other programs that may change, or
>> hardware that users may change, or data the programmer didn't
>> anticipate, and suddenly go completely wrong.
>>
>> Ignore the article. While it's true that a lot of computer software,
>> including shell scripts, are created by people who don't know enough
>> to do it properly, that doesn't mean software should not be created.
>> It just means people need to learn to do things properly.
> I agree about ignoring the article and learning to do things properly.
>
> Most of the examples in that article were of the form:
>
> some_command
> echo "Success"
>
> I.e., they never once checked the exit status of the command and always
> unconditionally reported success. They then used their broken examples
> to claim shell scripting is bad.

Not checking the returned status from a function/command call is VERY
VERY common no matter what language! People who don't check the returned
status are just bad programmers.

It appears the guy who wrote the article was just saying bad programmers
shouldn't write programs!

Re: Stop writing shell scripts

<t1v99f$rld$2@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=7177&group=comp.os.linux.misc#7177

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tnp...@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.os.linux.misc
Subject: Re: Stop writing shell scripts
Date: Tue, 29 Mar 2022 16:40:31 +0100
Organization: A little, after lunch
Lines: 10
Message-ID: <t1v99f$rld$2@dont-email.me>
References: <t1sr34$127i$1@gioia.aioe.org>
<op.1jq5xgb1a3w0dxdave@hodgins.homeip.net> <jaef9dF6f49U1@mid.individual.net>
<slrnt467m2.bia.jj@iridium.wf32df>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 29 Mar 2022 15:40:31 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="264e40412cc2a22ac1040aa822d83cd7";
logging-data="28333"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193cjz7hTZQE/rSANq3/HelcX3rmaRX9P0="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:MoJrVUdMa2DyZ5kzLhwtDPMuDMA=
In-Reply-To: <slrnt467m2.bia.jj@iridium.wf32df>
Content-Language: en-GB
 by: The Natural Philosop - Tue, 29 Mar 2022 15:40 UTC

On 29/03/2022 15:59, Jim Jackson wrote:
> Not checking the returned status from a function/command call is VERY
> VERY common no matter what language! People who don't check the returned
> status are just bad programmers.
People who do check the return status of void functions are very bad
programmers

--
No Apple devices were knowingly used in the preparation of this post.

Pages:123
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor