Hacker News new | ask | show | jobs
by sdfjkl 1940 days ago
Fish is my shell of choice for a couple years now. Not because it's the perfect shell, but because it's a lot better than any other for interactive shells.

For scripting I still stick to bash because it's more portable and I already know how to cope with its warts. And sometimes when I can't remember the fish syntax by heart, I just launch a bash from inside fish to run my command and then Ctrl-D :-)

3 comments

I switched to fish a very long time ago (2009 maybe?) because it started up so much faster than zsh w/ all the plugins that it took to get the fancy features fish had out of the box. Since then, fish has only become a lot faster as we have focused on performance and optimizations considerably.
I tried zsh after fish and my impression was somewhat like this: Okay, so I got to do a lot of customizing to get this to work nearly as well as fish does out of the box - can't be bothered!
My impression of ZSH after fish is "ok this made for a really annoying couple of hours to set things up, but now I'll never have an incompatibility hassle again!"

When I was in school and working on my own stuff I liked using fringe shells like xonsh and fish, but working in teams I feel like I need a pretty significant productivity increase to justify using a different tool than everybody else.

Unless you source a lot of shared scripts why would it matter what shell you use interactively? You can install fish and bash side by side and use one in your terminal and one for scripting.
I share a lot of snippets and commands with members of the team, write a lot of bash (which I like to debug in interactive mode), and often follow or produce documented procedures in interactive shell (not quite repetitive enough or frequent enough to bother scripting).
There are even things like bass and replay.fish to deal with sourcing bash scripts
I felt that way until setting up a new computer, then I don't bother and install Fish and move on.
Omz plugins are the worst thing to happen to zsh, only surpassed by nvm.

Omz has so much compatibility code that you end up with way more than you need and a lot of what it ads can be shimmed to lazy load.

Nvm is just fucking trash. I had to rewrite large parts of it to not be total garbage. It still is. Go look at how it's installed and how it loads itself its fuckin insane.

I'd just like to add that if you're considering the switch but are worried about compatibility with bash, things have gotten better. I wouldn't call it outright compatible, but the most problematic differences in syntax (e.g. the absence of &&) went away a few years ago.

If it didn't quite stick the first time, I think it's worth trying again.

The parsing and setting of environment variables was always my #1 hassle with fish. I feel like I see a lot of BASH snippets that get copy pasted around that I always had to re-write or throw in a sub shell. Particularly annoying when you're trying to do something while screen sharing and somebody gives you a snippet which you have to re-write before using it- "Oh yeah it's a hassle but I've got sweet auto-complete" gets old
IMO, copy-and-pasting bash commands is an organizational smell to begin with, but I don't think this particular use case is a reason not to use one shell over another. If you do have a snippet of bash to run, it's easy enough to toss it in a file (with a shebang) and run it as a shell script. And as a bonus, it's reusable and you can add comments/notes for when you have to run it again.
> IMO, copy-and-pasting bash commands is an organizational smell to begin with

The people who develop the automation have to start somewhere :). If you're standing up a test environment or a PoC, writing down commands get's you 80% of the way to reproducing your results

I think the bigger issue is with programs (e.g. nvm) that are either implemented as collections of shell scripts, or function by dynamically generating shell commands.
Fish now supports setting environment variables for a command easier. Previously you had to do

    env MIX_ENV=prod mix compile
Now you can just do

    MIX_ENV=prod mix compile
But I also generally don't use fish for any scripting, I just use bash for that. But at least some copy-paste commands aren't as difficult to translate now.
Agreed. I really wish they would adopt `export`. It's not like `set` is any better.
Mind blown.

This is the best news I've heard all week. Thank you kind stranger!

Same here. Fish makes certain things easier (working with variables, for example) but sometimes I still drop a bash shell.