Switching Back to Bash From Zsh

I’ve used ZSH as my interactive shell for almost 10 years now. You can read the original post here. My age is showing. ZSH has been a trusty companion, and we’ve done quite a bit of campaigning together. Why switch back to Bash and ble.sh?

Spoiler: For me, it’s mainly two reasons. Bash has better tooling and I write bash more than I write ZSH. ZSH has better frameworks, but I found I didn’t need them over time.

Many hours have gone into iterating between various setups. Why not write a blog post for the undecided? Maybe you’re on the fence and looking for more information on whether the switch would be worth it? I’ll walk you through some of the different setups with some pro’s and con’s so you can choose the right one for you.

Setup 1: ZSH + Full Framework

If you were command line connoisseur in the early 2010’s, your best option was ZSH. Your framework of choice was probably ohmyzsh, it currently has 167k stars on github. There was also prezto which was smaller, but what I ended up using. The most important features, to me, these frameworks provide are themes and plugins.

ZSH themes do all kind of dynamic goodness that turns your prompt into a rocket command center. Of all the features, vcs_info was the most handy. It displays git information in your prompt. I spent many hours testing, tweaking, and eventually, currating my own prompt.sh. To this day, I still don’t fully understand what that file was doing. It was alien.

The plugins are usually designed around tools. They provide things like alias shortcuts and autocompletes. Most of my git aliases and functions are heavily inspired by zprezto’s git module. Depending on the number of plugin you enabled, it could bloat your startup time. This is frustrating when you use Tmux and try to create splits. Not very fun to debug when things go wrong either.

All of this you can have with a pretty smooth and hands off experience. These frameworks are powerful. For myself, I wanted to keep things simple. You will have to decide if you want trade a bit of bloat for convenience. With time I learned how to manually pick the aliases and completions I wanted. Instead of installing the whole framework, I could just cannibalized what was needed.

Setup 2: ZSH + Zplug

Then came the ZSH plugin managers like zplug and antigen along with ZSH plugins. Frameworks were no longer required, you could plug and play what you needed. The Awesome ZSH Plugins is staggering.

My plugin list ended up being relatively short:

The requirements here are download 4 git repos and source them. Updating the repos isn’t that hard to do manually. I don’t think I even updated the plugins aside for initial setup. So I stopped using a plugin manager and wrote a quick script to clone the repos I wanted. They’re easy enough to include in your .zshrc:

source "$HOME/.dotfiles/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
source "$HOME/.dotfiles/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh"
source "$HOME/.dotfiles/zsh/plugins/z/z.sh"
source "$HOME/.dotfiles/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"

At this point, the only thing keeping me on ZSH is four plugins and prompt themes. I personally don’t see many cons with this setup. It’s extremely light-weight and easy to maintain. Given a choice between a framework and a plugin manager, I’m choosing plugin manager.

Setup 3: Bash + ble.sh

This probably isn’t for you. Much of my day-to-day also involves writing Bash scripts. The prevailing wisdom is to use ZSH for interactive stuff but Bash for scripts. But I like scripting for my interactive sessions.

Problem 1: Not all zsh translates to bash. Things like builtin commands, like read, or arrays. Yes, you can add conditionals depending on the $SHELL, but I prefer simplicity. If I’m writing a bash script for work, I like being able to copy snippets from my personal bash scripts.

Problem 2: zsh doesn’t have great tooling. Bash has both a language server and shellcheck, which are excellent. To my surprise, ZSH has no equivalent with the same level of community support. I even have CI Checks for my Bash files now. But maybe you don’t care about tooling that much.

Now I needed to replace prompts and the four plugins.

One day someone showed me [starship.rs] and I never looked back. It covers all the use cases I need; fast, pretty, ships a binary. No more manual curation of my prompt.sh script. It also has a lengthy list of integrations.

Then I found ble.sh, the final nail in the coffin. Those 4 plugins that I was clinging on to could be laid to rest. See ya!

Conclusion

I don’t expect many to make the jump from zsh to bash + ble.sh for interactive sessions. Zsh covers almost any need you could have from a prompt. If you write a non trivial amount of bash, the jump might prove useful. Find the setup that works best for you and don’t sweat the rest.