Live data from Hacker News

The fish shell is amazing

rmpr.xyz

221–230 of 302 posts

Re: The fish shell is amazing

#221
I really liked fish when I used it but unfortunately the non-compliance with other shells is just too much hassle given the feature set (autocomplete is cool but I always know when I have python3 vs python4), like not being able to just copy paste “export VAR=…” from the web like I have been my whole life.

Re: The fish shell is amazing

#222
post #154

Earlier quoted context omitted.

I don't get why people expect POSIX compliance from fish. Your interactive shell and your scripting shell can be, should be, and often are, different. I use bash as my default user shell, fish as the default shell of my terminal emulator, and I write scripts for both POSIX sh (dash and busybox ash) and bash. I end up using three different shells with different purposes. Sure, I could use zsh both as an interactive an…

> Not to mention that zsh shouldn't be used as a scripting shell in the first place. Why not? If I'm writing scripts for automating configuration on modern macOS, for example, where ZSH is installed by default, why not write ZSH scripts?

It's more "why not write scripts?" Actually making use of a shell's control structures is code smell until we have far better shells than we currently do. They're optimized for user interaction, not necessarily anything else.

Re: The fish shell is amazing

#223
post #7

I used fish for a couple of years and really liked it. But I recently learned that I can configure ZSH to have all of the same auto-complete and plugins that I loved from fish. Now I have all of the creature comforts I like, with POSIX compliance I found that while fish has better syntax than bash for most things, the hassles with incompatibility or unexpected behavior brought me much more trouble than BASH's syntax…

The best reason to choose fish over zsh is that everything works so well out of the box that you stop messing with it. I haven’t tweaked my shell config in 7 or 8 months now. This is a different mindset from the giant zsh configs, “plugin managers” and other junk that is wholly irrelevant to using the shell. You’d think that fish incorporating a lot of functionality that zsh has would manifest as bloating fish, but,…

Even less ergonomic shells like bash can work very well out of the box if you just train yourself to use them. If you train yourself to use bash without any plugins, you'll be strong on any machine without any config.

I went through a "distro hopping" phase at some point with Linux and ended up settling on a system with very little custom config. It's close to the defaults so I can work very comfortably even in a random server.

Of course this is not ideal. If you have a tool or set of config that you like, then you should use it. I've just found that the human brain can overcome bad UX quite well with a little effort ;)

Re: The fish shell is amazing

#224
post #222
post #154

Earlier quoted context omitted.

> Not to mention that zsh shouldn't be used as a scripting shell in the first place. Why not? If I'm writing scripts for automating configuration on modern macOS, for example, where ZSH is installed by default, why not write ZSH scripts?

It's more "why not write scripts?" Actually making use of a shell's control structures is code smell until we have far better shells than we currently do. They're optimized for user interaction, not necessarily anything else.

If you're gonna be calling a lot of external programs and interacting with files a lot, non-shell scripting languages tend to feel pretty clunky.

I know what you mean, though. Most shell languages don't feel like flexible, expressive programming languages in the way that they ought to and could.

As you may know, there are some new shells/languages that are trying to bridge the gap in a way that still leaves the shell well-suited to interactive use. The Oil shell wiki has a great list of them (and Oil is one such shell itself, of course): https://github.com/oilshell/oil/wiki/Alternative-Shells

Re: The fish shell is amazing

#225

Earlier quoted context omitted.

The only issue I ran into this was when the one liners had subshell syntax $(cmd here), and all I had to do was convert $() to just ().

AFAIK that will be remedied in an upcoming release.

Indeed, the following should work with upcoming fish 3.4:

    echo "pwd: $(pwd)"
See https://github.com/fish-shell/fish-shell/pull/8059

Re: The fish shell is amazing

#226

Earlier quoted context omitted.

The best reason to choose fish over zsh is that everything works so well out of the box that you stop messing with it. I haven’t tweaked my shell config in 7 or 8 months now. This is a different mindset from the giant zsh configs, “plugin managers” and other junk that is wholly irrelevant to using the shell. You’d think that fish incorporating a lot of functionality that zsh has would manifest as bloating fish, but,…

Even less ergonomic shells like bash can work very well out of the box if you just train yourself to use them. If you train yourself to use bash without any plugins, you'll be strong on any machine without any config. I went through a "distro hopping" phase at some point with Linux and ended up settling on a system with very little custom config. It's close to the defaults so I can work very comfortably even in a ran…

There are other benefits to your approach. Relatively little time is spent configuring software and it tends to be easier to copy over a handful of simple configuration files than to replicate a complex setup.

Re: The fish shell is amazing

#227
post #7

I used fish for a couple of years and really liked it. But I recently learned that I can configure ZSH to have all of the same auto-complete and plugins that I loved from fish. Now I have all of the creature comforts I like, with POSIX compliance I found that while fish has better syntax than bash for most things, the hassles with incompatibility or unexpected behavior brought me much more trouble than BASH's syntax…

Same, I used oh-my-zsh, I mucked around and didn't use it for some years, but since re-installing it, I have to say it's one of the most useful and reliable software packages I know of.

I kind of forgot that even use it until I read your comment :)

Re: The fish shell is amazing

#228
post #224
post #222

Earlier quoted context omitted.

It's more "why not write scripts?" Actually making use of a shell's control structures is code smell until we have far better shells than we currently do. They're optimized for user interaction, not necessarily anything else.

If you're gonna be calling a lot of external programs and interacting with files a lot, non-shell scripting languages tend to feel pretty clunky. I know what you mean, though. Most shell languages don't feel like flexible, expressive programming languages in the way that they ought to and could. As you may know, there are some new shells/languages that are trying to bridge the gap in a way that still leaves the shell…

> If you're gonna be calling a lot of external programs and interacting with files a lot, non-shell scripting languages tend to feel pretty clunky.

Perl's actually pretty good here; I'm pretty new to it, but it's generally what I reach for when I feel like a bash script has gotten just a bit too complicated.

Re: The fish shell is amazing

#230
I've gone down the rabbit hole with zshrc/bashrc customization, there are endless options and gists and pages and its a never ending rabbit hole.

In the end I realized a well configured toolkit is enough for 99.99% of people, and there are an endless number of those as well. I use zsh-quickstart-kit which is updated often and has good speed and amazing features. You get all the fish features AFAIK and more with no risk of scripts breaking and it was a 1min install.

For non devs who don't need to script I'd recommend fish and there are distros that default to it now.

Post reply on HN