Bash or fish
Hi guys!
I am currently using bash as my main shell, but I'm thinking about switching to fish to try it out. Are there any unexpected (bad) things that could happen, in general?
Thanks!
About this post
- Posted
- Archived
- Score
- 40 · 100% up
- Kind
- Text
- ID
- a07cf7
55 comments
You can have all of the cool functionality of fish and still have bash-compliant shell with zsh. I can't recommend it enough.
^That.
My own and tried ‘algorithm’ for choosing the shell:
Justification: fish is easy to use, nice looking and reasonably configured out of the box, but is significantly different than anything else (sh, bash, csh, ksh, zsh…). zsh, on the other hand, is almost a strict superset of bash, with all the things working as intended, where you can use your ‘bashisms’ almost unchanged, plus enjoy all the new, good stuff.
And if you can’t use that, bash is the facto standard on most *unix-like systems and you can safely assume it (or something compatible with it) will be available.
I have experience with bash but on my computer I can have any shell I want, so atm I'm bouncing back and forth between conditions 2 and 3 haha. Should I give both zsh and fish a try and see which one I like most then?
My algorithm would be more like:
Nothing against zsh either, but you can do nearly all the things people do with zsh with bash, they're just less obvious. There's a bunch of bash shell options IMO should be on by default.
Thanks, I'll look into it.
Yes and combine it with ohmyzsh and it's far more powerful, still easy to setup. Fish has no a few quirks, little different syntax in a few places and can not work with shortcuts like !!. Zsh has full bash compatibility (as far as I know).
Yeah I tried fish for a few months then stuck with zsh. For me the main thing was tab completion over rsync and scp wasn't working in fish.
I use fish.
POSIX/bash compliance is relatively moot for an interactive shell, imho. If I need to run sh/bash scripts, the shebang at the start of the file automatically switches the shell. If I truly need to use an interactive bash shell I just open one inside fish.
As another user has pointed out you can replicate most of the functionality of fish in zsh, but in my experience it is slower and not as elegant (history based autocompletions are a lot less accurate and more wonky). It also requires a fair bit of upkeep, and sourcing 20+ omzsh plugins from 20+ different git repositories has a significantly wider attack surface than fish (I run it on production servers).
Yes! you can't get away from bash. You will need to read bash scripts forever. You'll probably end up writing them too. However fish is great. I keep my shell as bash and have my terminal emulator launch fish. This gives the most bang for your buck. All the OS sourced stuff in
/etc/profile.dstill works, but I get all the convenience of man-page directed autocomplete, smart history completion, nicer shall syntax for one liners. Process substitution works with more commands. It's a great shell. Give it a whirl. Using and not using it is very unobtrusive.Let's also not forget universal env vars! You can do cool shit like global config switchers without needing to reload every shell to see the update!
This is true for most 'underdogs'. As Arch Linux users we will run into a ton of Ubuntu, and even more Windows. The neat thing about fish is it is 95-99% equivalent to bash. All of the oddities that come from writing/reading code for bash are there in fish, just with a prettier syntax. stdin/stdout, subshell commands, pipes, 0/1 true/false reversal, etc.
If you learn fish, you aren't locked to the language. You can pick up bash with relative ease because the underlying concepts are almost entirely the same.
The inner developer in me cried when I saw this. "Imagine global variables, but system wide". They are super cool for config settings.
Another fish user here. The reason I like it is that it has everything I need out of the box. The configuration is simple, the documentation plentiful, and the syntax is actually readable.
You could have that with zsh and oh-my-zsh and a bunch of plugins, but in fish it's all in the defaults.
This is my main reason to use it.
Not "bad thing", but somes command line doesn't work the same way, && for example become "; and", also command nesting is a bit different, it might be a bit annoying but it's notre hard to edit them and make them works.
Thanks, I'll read the documentation then.
Also, I think fish will actually warn you about this (i.e. if you accidentally use a &&, it'll print a message warning you that this is not fish syntax).
Yep, even the syntax highlight it IIRC.
There is one thing to look out for though: people often write scripts to prepare their shell environment, e.g. in work projects with multiple participants. This is the kind of situations in which people will blindly shovel whatever bashisms seem functional, probably breaking your shell. In these environments it's easier to just run bash like everyone else instead of pushing for POSIX-compliance which no one cares about IRL.
I don't personally like fish for believing that configuration is evil.
Trying to ship with friendlier defaults doesn't equate to believing configuration is evil.
From their Design Document:
https://fishshell.com/docs/current/design.html
Go for it. It is easy to switch back if you do not like it. I did as much when I tried it out some years ago but found it too bloated and "featuristic".
If you are too familiar with bash or at the beginner level in linux shells, go for zsh. It is very customizable and all of your existing commands/knowledge on bash will go just fine with it.
Fish, on the other hand, is not a pro thing or something like that. It just uses a slightly different syntax; which, in my opinion, is simpler and cleaner. It has rich features and great user experience out of the box with very litte or no configuration at all. However, a lot of the bash command syntax and scripts will not work on fish. You have to convert/rewrite those, given that you are familiar with the fish syntax. It's not the case that will trouble you always but important to mention. If that seems okay to you, then try fish. It's great.
Thanks to everyone for your replies, once again I was proven that the Arch community is the greatest!
I preffer ZSH which is a little more similar to FISH; however ur always gonna need a bit of BASH, and i like ZSHs attempt to minimize the difference and add compat
xonsh
Just dropping by to say, if you want to go with zsh as people mentioned, i would suggest using zim-fw rather than oh-my-zsh for plugin functionality. It is much faster in my experience.
Have no experience with fish, but zsh is very nice, and very fast on my system.
zsh
zsh
If you use fish purely, you probably won't be able to launch %90 of the shell based scripts, since most of them is written in bash. Some very popular scripts ( nvm for example ) has custom-made fish versions, but chances are you won't find a fish variant of every cool script you are desperate to launch. Zsh is where its at, my friend.
But overall, fish is really cool and good, i love it.
Using fish has zero impact on being able to run bash scripts. An executable text file has a shebang as the first line.
Example: #!/usr/bin/bash #!/bin/bash #!/bin/fish #!/usr/bin/env bash
This is #! followed by a path to the executable that will interpret the file.
You can even switch interactively to bash by typing bash<Enter>however much bash you like then exit<Enter> or even run just a little bash with bash -c 'some bash here'.
Ask yourself what you need from a different shell to justify the switch. Bash is fine and everything is written based on a shell being Bash. My next choice would be Zsh, it has more features that Bash and it has oh-my-zsh to make it look nice.
Sorry I have no opinion on Fish tbh. It's not one I've considered as zsh is the better alternative for my liking.