11 ms·
So the massive drawback of fish is it's incompatible with bash (and other shells people use). If you're in fish, this is easily remedied because almost every ma
by ddek 5y ago
So the massive drawback of fish is it's incompatible with bash (and other shells people use). If you're in fish, this is easily remedied because almost every machine has bash too. However, you can't expect another machine to have fish.
However, I just really like fish. I also live out of my own shell, and I don't spend much of my life remote-ing into other machines. When I do, my mind flips into bash just as easily as I flit from TypeScript to C#. To me, this is largely a non-issue, aside from when I need to work out how to set the `$SHELL` variable for a program that expects bash.
- xvolter 5y agoI agree entirely. I've tried zsh and other replacements, but I keep coming back to Fish. It's intelligent, loaded with features, and ohmyfish adds a lot. No other machine I connect to has fish, but for my own machines, it's my top choice. Still, I write a lot of utility scripts in bash for the compatibility and it can be annoying when I copy a command and I know it won't work because it uses some unsupported syntax in fish. Every now and then, and it is rare, I switch to bash locally to run something.
- mxcrossr 5y ago> However, you can't expect another machine to have fish. I can, because whenever I get access to a new machine I download and compile it!
- CRConrad 5y agoWell lucky you, that you always get download-and-compile rights on any machine you access. Not everyone is so lucky.
- mattgreenrocks 5y agoAbout 98% of common POSIX shell usage is covered by fish, right down to identical syntax. (Not everything is.) Biggest tip for fish switchers: set fish as your terminal's shell instead of changing your login shell.
- quells 5y ago> Biggest tip for fish switchers: set fish as your terminal's shell instead of changing your login shell. That's an interesting idea - I will try that. This bit me recently when I used Migration Assistant to move from a Mac with Catalina to one with Big Sur; my login shell was still set to the path for fish installed via Homebrew, but none of those packages were copied over. I managed to hack around it by copying bash into that location so that I could reinstall Homebrew and fish to finish repairing things.
- mattgreenrocks 5y agoIMO it's worth it to avoid Relocated Items popping up after every update.
- bobbylarrybobby 5y agoIf you do this, you will probably also want to add `-fish` to Terminal's preference Profiles > Shell > Ask before closing (*only if there are processes...). This will prevent you from getting prompted when closing a Terminal tab with the default shell running.
- aryamaan 5y agowhat's the difference between the two for the non initiatives?
- mattgreenrocks 5y agoAFAIK, login shell can be thought of as the default shell anytime you start a shell. By default your terminal program uses that, but most terminals let you override that to be something else.
- mixmastamyk 5y agoI still fail to see a significant difference. Been using fish as my shell for perhaps 15 years. Perhaps not having to run chsh on a new machine, which I have to run -h on to remember how to use ever few years.
- mFixman 5y agoMy biggest drawback for fish is that there is no way to concatenate several commands inside a block that I know of. In bash, I can run the following do the following, and the only ways I found to do this in fish are using several commands or calling `bash -c` with a subcommand. ``` (cat file_1; cat file_2 | grep something) | sort ```
- faho 5y agoIt's simply a block, and fish specifies blocks with "begin" and "end". begin; cat file_1; cat file_2 | grep something; end | sort (note that this is distinct from a "subshell", which has a separate environment and typically is more confusing than helpful. In this particular case it doesn't matter)
- kstrauser 5y agoSame for me. And fish is so much nicer that I’m not willing to use a less ergonomic shell on the system I use 99% of the time for the benefit of having it act exactly like the 1% environments. And FWIW, those 1% environments don’t look and exact exactly like my local system, where I have a nice prompt configured and there are lots of aliases and functions I use frequently. My local bash is nearly as different from my remote bash as my fish is from bash.
- andix 5y agoI really don’t get this argument. In my shell I don’t type scripts on the prompt. I use fish most of the time as a shell, but I still write bash or even sh scripts, because fish is not installed on most systems. If you run a bash script from fish, it is still executed by bash (because of the shebang).
- aryamaan 5y agoBut one of the selling points of fish is (from their website, I am not a user) that it has sane scripting. That point appealed me most. If I continue have to use bash for scripting, I wonder what fish provides over zsh.
- chubot 5y agoI think fish's syntax is cleaner, though as others have pointed out, the incompatibility is often not worth it. Even though it's "sane", I would say it's not "powerful". It's significantly less powerful than bash, e.g. there is a list of missing things here: https://github.com/pirate/fish-utils/blob/master/README.md https://github.com/pirate/fish-utils/blob/master/README.md The first one seems like one of the bigger issues: https://github.com/fish-shell/fish-shell/issues/159 https://github.com/fish-shell/fish-shell/issues/159 I have a particular viewpoint since I'm writing a shell for scripting, and I wrote this FAQ. http://www.oilshell.org/blog/2021/01/why-a-new-shell.html#whats-the-difference-between-oil-and-fish http://www.oilshell.org/blog/2021/01/why-a-new-shell.html#wh... But I didn't come up with that list of issues, and I've only used fish a tiny bit.
- netvl 5y ago#159 kind of works with the `string collect` mechanism, although it is indeed not very obvious, compared to bash: set file_contents (cat filename | string collect -N) I understand that this is purely anecdotal, but I'm using fish for quite a long time, I've written a lot of tooling for myself in fish, and I agree that sometimes there are some things which are annoyingly missing from fish (like this multiline variable thing), but I would not say it makes fish significantly less powerful. And these things are sometimes fixed, too.
- lucideer 5y agoI think this warning is actually harmful: Years ago, I read this argument about fish and it turned me completely off using it. Only more recently have I really realised this never applied to 99% of my (most people's?) use-cases. The logical step many people miss is that shebangs make the compatibility of the user's shell largely irrelevant: the only real compatibility concerns are the bash version or `sh` aliasing on the user's system. e.g. making bash scripts compatible with current macOS systems (outdated bash version and bsd-ish non-gnu binaries) is a far bigger pain than any compat issues fish brings.
- masukomi 5y ago> Only more recently have I really realised this never applied to 99% of my (most people's?) use-cases. every time someone asks "how do i accomplish X task on the command line" (witness literally thousands of Stack Overflow posts like this) the answer is in bash. so, i say it applies to essentially every use case where you didn't already know how to do it. I love fish, but the fact that every answer to your questions is written in another language and has to be translated affects EVERYONE.
- BeetleB 5y ago> every time someone asks "how do i accomplish X task on the command line" (witness literally thousands of Stack Overflow posts like this) the answer is in bash. I don't get this argument: The solution is to search for: "how do i accomplish X task in fish" This is what I do with xonsh. Of course, the bigger point that is being missed is that when someone opts to use a shell like fish or xonsh, they're less likely to search how to do X! The reason they picked another shell is often because it is easier to use, etc. In the case of xonsh, it's mostly just Python. I do a lot more in it than I could do in bash, because I don't need to search the Internet for anything.
- jkubicek 5y agoI've been using Fish as my primary shell for years. The vast majority of the time those Stack Overflow answers written for Bash work as written in Fish with no changes. Occasionally you'll need to write the command substitution or command chaining in a different way, but once you get over the initial learning curve this is easy and pretty mechanical. Very rarely I find some command that just doesn't work in Fish, in those instances it's easy enough to open the bash shell or throw it into a script file.
- hibbelig 5y ago> So the massive drawback of fish is it's incompatible with bash (and other shells people use). This drawback is also its advantage, as it doesn't need to repeat all the Bourne-ish problems. (You seem to like this :-), just pointing it out for the others.) I think people who are interested in how they use the command line will not have a problem to learn two shells, fish for the personal use and something Bourne-ish for scripts that might run on other machines, or by other users.
- gnubison 5y agoThe Bourne shell certainly has problems, but IMHO fish should have stuck with POSIX syntax when it's "good enough" (TM). Stuff like $(code) vs (code) makes Fish feel like it just wants to be different. Things I think are big problems: * Needing to quote practically everything * Needing to remember if/fi, case/esac, while/do/done, for/in/do/done, etc.
- pkulak 5y agoI run Fish on all my machines as well, and it's not like it's _that_ different from Bash. Maybe just for me, since I do not use either to write actual scripts. Only thing I notice on the command line is not using a dollar sign before open parens.
- Bancakes 5y agoI find fish is a comfortable interactive shell and dash is a performant script-running shell. Bash is in the middle.
- mixmastamyk 5y agoI really like this combo: 1) Use fish interactively, with quite a few aliases. 2) Write <= 10 line scripts in sh, perhaps with a bashism if it is very helpful, and only run on my machine. 3) Write > 10 line scripts in Python.
- knodi 5y agoIf all you do is copy paste other people's bash command than sure, stick to bash. The 99% of the time you're doing that you can use fish.
- flying_sheep 5y agoThere is no need to change `$SHELL` :-/ you can use Bass (https://github.com/edc/bass https://github.com/edc/bass) to execute any bash script and it will apply the environment variables to the current fish environment.
- emptysongglass 5y agoBass has never worked for me. I'm not even sure if it has worked for me once.