1. I agree. Bash is good. During early version of OS X they tried to force us into tcsh. It sucked. Everybody manually changed their shell to BASH. Now they going to do it again. Stick to BASH.

  1. Wow. In 10.1 (or was it 10.2?), zsh was replaced as the default shell with bash (which was also then hardlinked/installed as /bin/sh). That seriously broke a bunch of my production scripts, which started with #!/bin/sh (I was lazy and not expecting the language to change out from under me). There are syntactical difference between zsh and bash that mean your scripts are not always directly portable from one to the other.

    Pre-10.0, btw, the default user shell in what became Mac OS X was /bin/tcsh and, since I’ve never been a fan of C Shell and tcsh, the switch to zsh in 10.0 didn’t hurt me at all.

    I grew up on ksh (Korn Shell) from the days of SysV R2, so zsh seemed the more natural to me compared to bash, since Z Shell was conceived as a freeware alternative to ksh, which was only available at the time under license from the AT&T Toolchest. Still, there were a few nagging differences (e.g. piped co-processes via |& in ksh and the coproc keyword in zsh, to name one).

    IMPORTANT: So, calling back to my first paragraph: In macOS/Darwin, do not(!) start your shell scripts with #!/bin/sh, which any given update could wreck. If you’re writing bash, use #!/bin/bash and if ksh or zsh, use #!/bin/ksh or #!/bin/zsh. That may save you some panic-mode debugging at 2:30am on a Sunday morning when you should be sleeping or playing games instead of answering a PagerDuty escalation.

    That advice also holds (IMO) for any non-SysV Unix where /bin/sh isn’t a true Bourne Shell (which very few folks really know how to deal with any longer).

    ~~Jazzbo, who taught zsh and then ksh scripting at work for 15 years once Mac OS X came out.

    1. I used to work in a variety of IT jobs. Knew a bit of UNIX, a rare skill. Another worker had a number of scripts he used regularly to generate reports. Some were in csh, some in bash, some in ksh, some in yet another shell. I could read most of them, figure out what they were doing, but could never figure out why this script rather than that. He said “better this way, this one handles <!> better than the others”. My own scripts worked well enough, but I was no where NEAR his skill level.

  2. Terminal users beware!

    If you don’t use Terminal, you don’t care about this reply.

    Well, not really “beware”, but more “pay attention.”

    The entire startup routine kicked off by /etc/profile and ~/.profile if you’re not a C Shell (tcsh) user changes if your login shell moves from bash to zsh (or ksh, which I manually set every time I can).

    All those settings — from prompt strings and color to history and aliases — are managed entirely differently in bash vs. zsh (or ksh), as are variable decorations (the weird stuff you can do with ${varname…}).

    ~~Jazzbo (unskilled at bash other than when forced to write production scripts in bash because zsh and/or ksh aren’t available)

  3. After switching from bash to zsh. terminal executes better and faster than ever. And I had to fix all the error caused by incompatibility that costs me almost a day of work. Now I’m content with the result. Because some feathers pacified my pain. Anyway as alway I’ll be adapted to new shell down the road as if there’ weren’t nothing had happened.

Reader Feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.