logoalt Hacker News

vips7L • today at 2:08 PM • 3 replies • view on HN

Or just stop using bash. It’s a terrible language to write and has tons of footguns.


Replies

yjftsjthsd-h • today at 3:50 PM

For the things shell is good at (running other commands, pipes, and shuffling files), I have yet to find anything even close to as good.

➕ show 4 replies
CodesInChaos • today at 2:34 PM

Unfortunately half of its badness isn't isn't the shell itself, but the convention of how parameters are passed to processes on Unix systems.

➕ show 4 replies
malux85 • today at 3:40 PM

The widwit answer: "Dont do X" (and nothing more)

The enlightened answer "You should use A, B or C for these reasons"

Even though bash is installed on many systems, I try to encourage people to use better designed shells that have less of these footguns :

Fish (https://fishshell.com/): No implicit word splitting : spaces in variables won't unexpectedly become separate arguments.

Zsh (I use this: https://ohmyz.sh/): Arrays start at 1 by default, but crucially, unquoted variables don't implicitly split into multiple arguments.

Nushell (https://www.nushell.sh/): Passes structured tables and records between commands : avoids fragile parsing of text with awk/grep.