Hacker News new | ask | show | jobs
by minamea 4782 days ago
After using zsh for a while I moved back to bash. The main reason is that I want to learn bash well, because I might be writing shell scripts in the future and I don't want to use zsh specific features in my scripts so I don't want to get used to them.
1 comments

> I don't want to use zsh specific features in my scripts

How is this a worry?

The topline in your bash script is '#!/bin/bash'

Which tells the system 'run this with bash'.

Well I think there are if statements, loop conditions, and wildcard expansion that works in zsh but not in bash. So you could get used to something working in zsh, then you write an sh script with that thing, and then it doesn't work, and you have no idea why.

Example, I _think_ / (recursive globbing) works by default in zsh but not in bash. If you have / in a bash script without setting the right options then your script won't work and you will have no idea why until you've wasted a lot of time debugging.

When you insert this in the first line of your script

    #!/bin/bash
The specified program is run. From that point on, the bits you're executing in that script are 'bash' no matter what the shell you called it from is.

I've been running zsh on my local system, and happily writing [bash, csh, perl, ruby] using this trick.