Live data from Hacker News

The fish shell is amazing

rmpr.xyz

271–280 of 302 posts

Re: The fish shell is amazing

#271

Earlier quoted context omitted.

No, all the kinds of parameter expansion that exist in bash belong to 3 groups: 1. expansions introduced by the Bourne shell in 1979 2. expansions added by the Korn shell in 1988 (e.g. ${parameter#word} and ${parameter%word}) 3. expansions added by the Korn shell in 1993 (e.g. ${parameter:offset:length} and ${parameter/pattern/string}) There are no parameter expansions that have been introduced by bash. I agree that…

Are the case modification and @operator in ksh also? @Q is the one I use on occasion.

There are a lot of uses for "@", most of which come from Bourne sh or from ksh.

I assume that you refer to the "${PARAMETER@OPERATOR}" type of parameter expansion, which is mostly used to either replace invocations of tr for character conversions or to provide quoted strings.

You are right that this kind of parameter expansion is specific to bash and I was wrong when I have said that there are no bash specific parameter expansions. "${PARAMETER@OPERATOR}" is the only exception that was introduced by bash and which has not been taken from the Bourne or Korn shells.

I have forgotten about it, because I do not use it, precisely because it is the parameter expansion variant that is provided only by bash.

Re: The fish shell is amazing

#273
post #203

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. This is such an incredibly odd perspective to me. I use zsh and have not touched my shell config in years . Messing with configurations to get things working to your liking is a one time thing. I don't even use plugins. On the other hand, if fish doesn't work to your liking out of the box, and for…

> On the other hand, if fish doesn't work to your liking out of the box, and for many people it does not, there's no "messing with it" that's possible. What do you want to do that isn't possible? I also haven't messed with it in months if not more (fish in my case, not zsh) but years ago I messed with the prompt a lot to get it to my liking. (From a previous zsh config.) It was perfectly possible.

[deleted]

Re: The fish shell is amazing

#274
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?

> 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? I guess there are two reasons - if the script doesn't need arrays, POSIX sh (dash) scripts will be much faster than bash/zsh scripts - if you do need arrays, bash is vastly more ubiquitous than any other shell on the planet right now (except POSIX sh). It's install…

Good advice, thank you..

Re: The fish shell is amazing

#275
post #13

I've found fish to be absolutely wonderful for shell scripting. I can throw together a loop or a function with the sort of confidence I never could have in bash.

Scripting in Fish is great in that even when you're still pretty new to Fish, you almost never have to think much about syntax or worry about quoting/word splitting behavior. It feels a little LISP-y, in a good way.

Re: The fish shell is amazing

#276
post #17

Earlier quoted context omitted.

Many of the features are also achievable with pure bash with ble.sh ( https://github.com/akinomyoga/ble.sh ).

I find it amusing when people are discussing all these new shells and features, yet everytime I see someone letting them know they can do these exact same things in bash, there's absolute silence. It's not the first time I see ble.sh being recommended here with no reactions from the community whatsoever. As for fish, I've used it for a few weeks. Not having POSIX compatibility and GNU readline shortcuts made work muc…

> Not having [...] GNU readline shortcuts made work much, much harder.

That's weird. Fish has all of the GNU readline shortcuts OOTB and has for as long as I can remember

Re: The fish shell is amazing

#277

Earlier quoted context omitted.

> while Fish has some nice out-of-the-box features, they’re all achievable in Zsh with a few lines of plugins. The point of fish is that there is no configuration required. You don't have to learn to configure it, you don't have to be part of "the community" to learn which plugins to use, you'll be able to sit in front of any fish prompt and have it work as expected without having to move dotfiles around.

> The point of fish is that there is no configuration required. I think it would be more accurate to say that the point of fish is that there is no configuration allowed . If you don't like the out of the box configuration, I would say configuration is still required , but it's unfortunately not available . If you happen to like every single decision the developers made, then I admit having no configuration does mean…

Fish isn't that extreme. There's a fair bit of configuration allowed. The devs are just judicious about adding toggles.

You can configure scripting to run at various times, and there are even plugin frameworks for Fish. It just doesn't have toggles for things like language features in the way that ZSH does.

Re: The fish shell is amazing

#278
post #17
post #16

As another commenter pointed out, while Fish has some nice out-of-the-box features, they’re all achievable in Zsh with a few lines of plugins. And did you know Zsh has a short for loop? Along with fantastic plugins like fzf-tab, I don’t see a reason to use anything else right now. Though, I’m keeping a very interested eye on Nu shell. They’re doing a lot of stuff right, and I expect it will become a very useful scrip…

Many of the features are also achievable with pure bash with ble.sh ( https://github.com/akinomyoga/ble.sh ).

Ble.sh seems pretty cool. The path hacking it does on readlink doesn't work right and causes the CNF handler to launch on NixOS.

I guess it does the PATH hacking based on whether the system is GNU or not so that it can get `realpath`/`readlink -f`-like behavior even on systems that don't natively have that because they include *BSD coreutils.

That might not behave as expected (and is unnecessary) on my macOS systems, either, since I like to keep GNU coreutils (with no `g` prefixes on the executable names) on my PATH there (heresy, I know).

It's also noticeably slower, to the point that there's a bit of jitter as I type.

It's pretty cool, though. If it's any better after I patch the readlink PATH hacking out, maybe I'll configure it for bash on my systems.

Re: The fish shell is amazing

#279
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,…

Not to mention the speed of fish vs zsh launching is quite noticeable, zsh taking a second or so longer to launch

Re: The fish shell is amazing

#280
post #226

Earlier quoted context omitted.

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.

Put your configuration for stuff like this in a private github repo.
Post reply on HN