
Dave at YSAP has a nice little 3 minute video on syntax checking bash scripts. He introduces the `bash -n` feature and compares and contrasts it with https://www.shellcheck.net/ for doing that (and more). If 3 minutes is too long, `bash -n` syntax checks without executing the script. It's matched to *your* specific version of bash. It considers an empty file valid (as no errors occurred).

Ron via Talk said on Wed, 23 Jul 2025 23:13:18 -0700
Dave at YSAP has a nice little 3 minute video on syntax checking bash scripts.
He introduces the `bash -n` feature and compares and contrasts it with https://www.shellcheck.net/ for doing that (and more).
If 3 minutes is too long, `bash -n` syntax checks without executing the script.
It's matched to *your* specific version of bash.
It considers an empty file valid (as no errors occurred).
:-) URL please? I conducted a brief investigation that concluded: 1) shellcheck is *much* stricter than bash -n 2) bash -n appears to work on my ksh scripts as well as bash So where I see bash -n fitting in is as a course first test. Get all the errors and warnings out with bash -n, and *then* use shellcheck to nail the rest of the errors and warnings that fell through the (wider) cracks of bash -n. SteveT Steve Litt http://444domains.com

Steve Litt via Talk wrote on 2025-07-24 18:20:
URL please?
Ah, crap. Spent all my time finding URL for Shell Check.
A bonus short on bash built-ins, how to enable & disable them. i.e. uname.
He's discussed builtin vs external before. Most people (myself at least) gives very little thought to such things. But it's neat to enable / disable them, but why is an open question. Less resource usage, better speed?
1) shellcheck is *much* stricter than bash -n
Sure is. I'm now sad looking at its reporting on some of my larger bash completion scripts. My take-away: I love bash and I hate bash. It's maybe too damned complicated. zsh is looking nice, not that it's less complex, just... better Also, Shell Check is pretty cool. Bonus:
Can You Write A Web Server in PURE BASH?! (no socat, no netcat, no external tools)

Static checking of BASH scripts is a really good idea, to the extent it is possible. On oldster pontificating: History: - the original Unix shell was quite simple and crude - Bill Joy of Berkeley created C-Shell as an extension to the original UNIX shell. It was inspired by the C language - Stephen Bourne of Bell Labs did a powerful indiosycratic extension that was the standard shell for 7th edition Unix. - David Korn of Bell Labs extended the Bourne Shell in a number of interesting ways. ksh became available in 1983, long after BSD forked UNIX. - BASH was created dby Brian Fox for the GNU Project. Released in 1989. BASH is a re-implementation of the Korn Shell. The Korn Shell was not free software until 2000 so BASH was quite useful. Each of these shells got better for scripting. Only a few features were important for intereactive use. "History" was the main one. Part of that is improved editing of a command being entered. I think history should be built into the TTY driver so all interactive programs can benefit from it. The problem remains that these shells are all pretty bad for scripting. - So many errors are undetected or detected too late. - programming features are ideosyncratic, arcane, and unnatural. String handly, list handling, and arithmetic are each odd and awkward. For interactive use, they are too complicated. Here's a size comparison on penguin.gtalug.org (an old debian system): text data bss dec hex filename 106036 4760 11280 122076 1dcdc /bin/dash 1047220 46820 40232 1134272 114ec0 /bin/bash It's true that some of us take mastering these tools as a great challenge and feel good what what we accomplish. It would be better if easy things could be easy. Having said all that, I still write shell scripts. Carefully, and not too long. I always include set -eu (Look up what that means in BASH.)

On 2025-07-25 09:25, D. Hugh Redelmeier via Talk wrote:
History:
- the original Unix shell was quite simple and crude
- Bill Joy of Berkeley created C-Shell as an extension to the original UNIX shell. It was inspired by the C language
- Stephen Bourne of Bell Labs did a powerful indiosycratic extension that was the standard shell for 7th edition Unix.
- David Korn of Bell Labs extended the Bourne Shell in a number of interesting ways. ksh became available in 1983, long after BSD forked UNIX.
- BASH was created dby Brian Fox for the GNU Project. Released in 1989. BASH is a re-implementation of the Korn Shell. The Korn Shell was not free software until 2000 so BASH was quite useful.
If I win a lottery, then a "new shell" is one project I'll fund. Write once, run everywhere.

Sorry, I have to: https://xkcd.com/927/ just ... s/standards/shells/ On Fri, 25 Jul 2025 at 15:06, William Park via Talk <talk@lists.gtalug.org> wrote:
On 2025-07-25 09:25, D. Hugh Redelmeier via Talk wrote:
History:
- the original Unix shell was quite simple and crude
- Bill Joy of Berkeley created C-Shell as an extension to the original UNIX shell. It was inspired by the C language
- Stephen Bourne of Bell Labs did a powerful indiosycratic extension that was the standard shell for 7th edition Unix.
- David Korn of Bell Labs extended the Bourne Shell in a number of interesting ways. ksh became available in 1983, long after BSD forked UNIX.
- BASH was created dby Brian Fox for the GNU Project. Released in 1989. BASH is a re-implementation of the Korn Shell. The Korn Shell was not free software until 2000 so BASH was quite useful.
If I win a lottery, then a "new shell" is one project I'll fund. Write once, run everywhere.
------------------------------------ Description: GTALUG Talk Unsubscribe via Talk-unsubscribe@lists.gtalug.org Start a new thread: talk@lists.gtalug.org This message archived at https://lists.gtalug.org/archives/list/talk@lists.gtalug.org/message/ZBQ2YLV...
-- Giles https://www.gilesorr.com/ gilesorr@gmail.com
participants (5)
-
D. Hugh Redelmeier
-
Giles Orr
-
Ron
-
Steve Litt
-
William Park