Good stuff, but, conversely, one may just manually set any user's default shell [1] back to bash, or Bourne, ksh, csh, tcsh, or install and use another as a default shell, such as fish, nsh, nushell, rc, yash, etsh, and so on and so forth.
And with xxh (or Nix) you can take it with you to a ssh session near you. There is also a couple of plugins in OMF and Fisher to fix some bashisms Fish is missing.
Nice thing to learn - thanks. Although the only scenario I can think of at the moment would be the lack of netcat (and telnet).
Not a fan of limiting scripts with bashisms. I like them to be runnable under zsh and similar shells despite having /usr/bin/env bash, /bin/bash, /bin/sh shebang.
I've been using bash since the early 90s and I'm now in my 40s so I think at this point I just have to accept that I will never use another shell.
On Macs, the current version of bash can be installed from Homebrew and you can set it as your default shell in the SysPrefs, in Users > Right-click you > Advanced
This still presents an issue with shebang lines, though. I use ‘#!/usr/bin/env bash’ to work around this but occasionally have to modify other peoples scripts if they’re relying on newer bash features.
I tried fish and really liked it until I tried to run one of my numerous helper scripts and was faced with syntax error; too lazy to update so many scripts.
Not the op, but that only worked half of the time when running install scripts from the internet. To make it really work you basically had to setup and maintain a full bash environment in parallel to the fish environment (env variables, paths, etc...). Most software packages out there really expect that you're running in a bash-compatible environment.
All my scripts have "#!/usr/bin/env bash" at the top but in some cases that didn't help. Also, I think some bash specific bits in my .bashrc had syntax errors. Eventually I just didn't want to deal with the hassle of switching over.
Bash can do everything zsh can. You just need to know it well enough. There isn't any reason to change default shells to zsh except for licensing concerns by closed-source minded companies.
Of course it can. And a sufficiently large enough piece of paper and a well-sharpened pencil can do anything a computer can, but I suspect most people will choose to go on using computers.
> Why is zsh forced on users anyway? Are there known issues with bash?
ZSH isn't GPL which may be important in the smaller non-Linux part of UNIX-like world. I would very much like to see ZSH in FreeBSD's base system already.
The article mentions it is because Bash went to GPLv3 and Zsh is MIT, and Apple is (my words) allergic to GPLv3. They avoid it everywhere. (Which tells me its a fantastic license.)
Of course you don’t have to switch, since you can brew install bash 5 or whatever the latest is and then chsh to it, but if you want to use it as an opportunity to change shells, consider checking out some of the newer interactive shells like nushell, elvish, xonsh, oil etc. Some of them are even based on actual general purpose, fairly common programming languages.
I really want to try something new but many of those shells are not POSIX compliant enough to be a daily driver and that's kind of a deal breaker. I often run external shell scripts to install various things and the fear that the new shell environment might muck up something I didn't notice is too real. Would have otherwsie moved to fish long ago, so for now it looks like zsh is as good as it gets (unless my concerns are unfounded of course).
I don't actually think it's that big of an issue. Most of those kinds of scripts should have something like `#!/bin/sh` already to ensure they can be run everywhere and you could always run a specific script in bash/zsh if needed.
Worst case, really, is that many of them do $PATH manipulation, set Env variables for you, or setup autocomplete and you'll need to redo that work in your shell of choice if it doesn't act like bash/zsh (e.g. I think nushell would be the most annoying in this way).
A huge reason for my personal time investment in Nix has been to be able to ignore problems like this. I don't want to constantly fear that as I've finally decided to put effort into making things nice for myself for things to change without any recourse.
I've switched from bash to zsh a few weeks ago and overall, I'm pretty happy. Menu based auto completion for example is extremely nice.
But I could never get auto complete for rsync to work. I have some hosts in ~/.ssh/config (think "Hostname prod01" etc) , and in bash auto complete works for ssh, scp and rsnyc ("rsync prod01:someFile .")
In zsh, this only works for scp and ssh, but not rsync, and I haven't found a way to make this work.
Does anyone know how to get it to work like in bash?
I don't have a magical solution since you didn't give much context. I suppose that completion is enabled (compinit, complist) and generally working since you mentioned it for ssh & scp. Maybe you're just lacking the file that contains the completion instructions for rsync. It should be named "_rsync". In my case, Debian's "zsh-common" installs it in "/usr/share/zsh/functions/Completion/Unix/_rsync".
That's a good idea, thank you! I simply installed zsh over the package manager, autocomplete seems to work other than rsync. I'll look into it when I get back to the computer and report back.
But at the same time I feel it’s too close to bash.
I can still run bash scripts, so why does everything at the command line have to be almost, but not quite bash?
I think it would be nice with a bit more of a paradigm switch that could open up for some new interactive possibilities. But bash alternatives seems to be mostly a better version of bash for some definition of better.
44 comments
[ 3.7 ms ] story [ 84.0 ms ] thread[1] https://www.howtogeek.com/444596/how-to-change-the-default-s...
And with xxh (or Nix) you can take it with you to a ssh session near you. There is also a couple of plugins in OMF and Fisher to fix some bashisms Fish is missing.
But it's not. It's a bash built in pseudo file. So it should work in bash on other operating systems.
Not a fan of limiting scripts with bashisms. I like them to be runnable under zsh and similar shells despite having /usr/bin/env bash, /bin/bash, /bin/sh shebang.
What other cool use cases could it achieve besides checking if a domain is reachable?
We need a friendlier netcat, with better output. Call it netdog.
nc -v itself is pretty much telnet as far as TCP connections go (TELNET is itself another protocol on top of TCP).
In fact on macOS, I alias telnet=’nc -v’.
Anyway my intent wasn’t to directly challenge your method, this is just a more shell-independent and universal method of doing the same.
On Macs, the current version of bash can be installed from Homebrew and you can set it as your default shell in the SysPrefs, in Users > Right-click you > Advanced
https://github.com/zsh-users/zsh-autosuggestions
Best of both world really.
ZSH isn't GPL which may be important in the smaller non-Linux part of UNIX-like world. I would very much like to see ZSH in FreeBSD's base system already.
BTW, forced how?
Hardly insurmountable, but the change was a “forced” part of the upgrade.
I'm not too comfortable playing devil's advocate here as Apple really does force shitty changes on users. But this isn't one of those cases.
Worst case, really, is that many of them do $PATH manipulation, set Env variables for you, or setup autocomplete and you'll need to redo that work in your shell of choice if it doesn't act like bash/zsh (e.g. I think nushell would be the most annoying in this way).
But I could never get auto complete for rsync to work. I have some hosts in ~/.ssh/config (think "Hostname prod01" etc) , and in bash auto complete works for ssh, scp and rsnyc ("rsync prod01:someFile .")
In zsh, this only works for scp and ssh, but not rsync, and I haven't found a way to make this work.
Does anyone know how to get it to work like in bash?
But at the same time I feel it’s too close to bash.
I can still run bash scripts, so why does everything at the command line have to be almost, but not quite bash?
I think it would be nice with a bit more of a paradigm switch that could open up for some new interactive possibilities. But bash alternatives seems to be mostly a better version of bash for some definition of better.