News for hackers. Stuff that matters.
Re:The Linux cheat command by barbazoo on Thursday June 02, 2022 @12:16PM (#31596774)
Unrelated but I'm wondering. Should I switch from bash to zsh, if so, why? It's taken me quite a while to get up to speed with bash, especially scripting. How steep is the learning curve?
Re:The Linux cheat command by dlivingston on Thursday June 02, 2022 @12:41PM (#31597168)
Zsh is a superset of Bash. There's little-to-no learning curve from switching, if you just stick with Bash syntax, and many advantages.

Here is a good overview on Zsh vs. Bash [0].

My favorite Zsh feature is the plugin ecosystem [3]. Oh My Zsh [1] and Starship [2] are awesome.

[0]: https://apple.stackexchange.com/questions/361870/what-are-th...

[1]: https://ohmyz.sh/

[2]: https://starship.rs/

[3]: https://github.com/unixorn/awesome-zsh-plugins

Re:The Linux cheat command by yjftsjthsd-h on Thursday June 02, 2022 @04:22PM (#31600050)
> Zsh is a superset of Bash.

zsh is not a strict superset of bash; I have aliases that I still haven't figured out how to port

Re:The Linux cheat command by e40 on Thursday June 02, 2022 @02:00PM (#31598355)
I had a script that worked fine in BASH but errored in Zsh. It had to do with arrays and I don't remember the problem.
Re:The Linux cheat command by hothead334 on Thursday June 02, 2022 @03:03PM (#31599191)
It was probably that in zsh, arrays start at 1.
Re:The Linux cheat command by ufo on Thursday June 02, 2022 @12:48PM (#31597299)
I'll take this chance to shill for Fish. For interactive use it is a joy to use, with better defaults w.r.t. auto completion and history. Not much learning curve if most of the time you're just entering commands and pressing tab or arrow keys. I still use Posix Shell for scripts though, because it's installed everywhere.
Re:The Linux cheat command by UI_at_80x24 on Thursday June 02, 2022 @03:09PM (#31599256)
I'm going to go against the grain a little and disagree with a lot of the comments.

My suggestion is to use the same environment in development that you use in production. If you are running zsh on your servers then run zsh on your workstation.

I run a mix of Linux, FreeBSD, and OpenBSD servers in production; and have found that 99% of the time it didn't matter.

I had been using zsh on my workstation and about 25% of my server fleet. The others were either too old, didn't support it, or whatever.

Of those 75% of servers (over 500 boxes) a small handful encountered occasional problems when running my 'written on ZSH script'; that didn't happen when I re-wrote/tested the script on bash.

We are talking about ~4 errors over the course of a year-and-a-half or so.

It was more annoying then anything else; and nothing broke as a result of it. I just had to manually go do the work that my script was suppose to do.

I like zsh.

Re:The Linux cheat command by bloopernova on Thursday June 02, 2022 @12:33PM (#31597039)
Most bash scripts work fine in zsh. I recommend you switch because your learning curve will be very shallow.

Here's a gist (i.e. no ads) that I wrote to guide people new to zsh through some of the many options available: https://gist.github.com/aclarknexient/0ffcb98aa262c585c49d4b...

Here's a stack exchange post about the differences between zsh and bash: https://apple.stackexchange.com/questions/361870/what-are-th...

Re:The Linux cheat command by Datenstrom on Thursday June 02, 2022 @07:24PM (#31601884)
Definitely switch to zsh for interactive use, the differences are minimal enough it will not take any effort to switch. Even forgetting everything else just the superior tab complete is enough to make it worthwhile. Still use bash for scripts they will be more portable.
Re:The Linux cheat command by bombcar on Thursday June 02, 2022 @05:46PM (#31600915)
macOS ships with zsh and it was easier to switch all the linux boxes to zsh than to fight homebrew into giving me a relatively recent version of bash.

So far I've no complaints and oh-my-zsh is nice.

But I can't really point to something and say "oh I'd die without this zsh feature".