Hacker News new | past | comments | ask | show | jobs | submit login

Just another plug for Zsh: it has all of these features and then some.

- Safe-by-default parameter expansion: no word splitting unless you ask for it, even if you don't quote the expansion.

- Ability to use histoy expansions (like !!:gs/foo/bar) on parameter expansions, meaning "${foo:A:h}" is equivalent to "$(dirname $(realpath $foo))"

- Much better array support, including both integer-indexed and associative arrays

- A built-in CLI option parser that's pretty robust ("zparseopts")

- Lazy-loaded functions

- Floating-point arithmetic




Production servers don't generally have zsh available, while most have bash. That means that ssh sessions will use a different shell, and scripts I write will use a different shell. And so, the upside for using some funky shell locally is greatly reduced.

Whereas if I stick with bash, I can run my scripts almost everywhere and almost every server I ssh into has a familiar environment. Thus my knowledge of edge cases and scripting idioms from bash pay dividends.

For situations where I need better arrays, associative arrays, floating point arithmetic, I'm probably better off writing it in an actual scripting language.


Fair enough! One tends to get spoiled with Zsh, trying to go back to Bash.

In the past I've actually downloaded Zsh, compiled it from source, and ran it out of ~/.local/bin with absolutely no issues. But that's not something I'd advise.


People keep mentioning zsh to me in response to this article - I think I'll have to go and read up on it more.


I still stick with bash - but if you're willing to move to a "friendlier" shell - my recommendation would be fish. Better out-of-the-box box experience than zsh - but still has the issue that most servers will have bash as the default interactive shell for root etc.

https://fishshell.com/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: