💾 Archived View for ew.srht.site › en › 2022 › 20220804-re-bash-misadventures.gmi captured on 2023-04-19 at 22:34:37. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

➡️ Next capture (2024-06-16)

-=-=-=-=-=-=-

2022-08-04

Re: Misadventures with bash shell

tags: software

Stacksmith has headaches with bash:

It seems completely nuts, acting completely different if you change a whitespace.

gemini://gemini.ctrl-c.club/~stack/gemlog/2022-08-01.bash.gmi

local copy

Your post made me smile!

I will admit that bash syntax has a lot of baggage from days long past, however, I am living in shells (sh, csh, tcsh, ksh, pdksh, bash) since like 1990 pretty much every day. I use bash as a glue language, because it is always there. I have tried zsh about 20 minutes, but it got in my way fast. I will say that a command shell without pipelines is useless in my not so humble opinion. But I do still learn. A thing I added only recently ist the use of __git_ps1 in my shell prompt.

PS1='\u@\h:\w$(__git_ps1)\n\$ '

To me python and C++ look completely incomprehensible. I learned perl4 and perl5 and C way back. I also learned some Forth, where the only syntax is this:

Tokens (called words) are separated by one or more spaces.

That's it. And yes ':' and ';' or '+' are valid tokens calling their associated code.

So to me it is just the other way round. In shell scripts I can spot a spurious space or quote quite fast. And since I can rely on bash being installed everywhere I have to work, I do use bashisms like associative arrays (think hash tables) and a lot of the ${var#/%}-edit something modifiers, or <(process substitution) and the like. By the way: I keep shellcheck running via flycheck in my emacs buffers, but it cannot always get "it" right :) I recently came across a line, where shellcheck demanded quotes, that would brake the script. The details are not important, but yes, these cases exist.

Stacksmith:

I wish there was a compact Common Lisp shell.

Not all hope is lost: scheme shell good enough?

https://www.linux.com/news/scripting-scheme-shell/

https://scsh.net/

Happy hacking!

Home