Using fish shell
I have been using fish as my user shell for the past year and a half, and these are my opinions of it.
Benefits
It is easy to write simple scripts in. I have not written a lot of scripts that would be posix compliant in posix-compliant shells like bash or shell, but the syntax of fish make it easy to get simple things done. For example:
# fish
for i in (seq 0 10)
echo $i
end
vs
# bash
for i in {1..10}
do
echo $i;
done
While this is easy to get used to, these differences build up along the way and make learning posix compliant shell scripting more complex. While I still do write posix compliant scripts I end up consulting the pure-sh-bible and shellcheck a lot. Way more than I feel I should be checking these and slowing down the process in the meantime. The nice syntax also allows me to end up writing longer scripts before I have to start about rewriting it in a language more suited for the task I am trying to accomplish. My general rule of thumb before was that if a script was approaching 30 lines that I should start to think about moving it to a better language, but now that is 100. This is due to again the syntax being easier to understand and read when coming back to a script I might have forgotten about.
Some smaller things that are nice is that out of the box fish is nice as a user
shell. It has builtin key-binds for editing the current buffer in your $EDITOR
of choice, nice syntax highlight, and a snazzy auto suggest based off of history
and flags that commands can take. This over all makes it feel like everything
was thought about in using this as a user shell.
Cons
The drawback to having a non posix shell is that the scripts that I do write
will only work on systems with fish installed. This leads me to writing some
scripts in posix-compliant shells for things that I need to work on systems that
may not have fish installed. An oddity of fish is that it has a web based configuration
option. This sounds nice at first until you want to change something simple and
I have to end up opening a web browser to make the change. Another thing that is
slightly bothersome is that scripts that use environment variables do not work
well such as nvm. There are workarounds for
this such as bass and spawning fish at the end of
a .bashrc
or .zshrc
file. I do not use nvm often but when I end up needing
it, it has been easiest to just drop down into a bash shell for the period that
I need it. One of the last draw backs is that there has not been the amount of
time put into documentation of fish-shell as there has been into bash
or other
posix shells making it harder to find answers to questions that should be
simple.
Overall
Overall I find that fish-shell is a simple and effective shell to sit down and take the time to learn. The benefits are outweigh the cons, and given more time I hope I will be able to learn more about fish and other shells.