Live data from Hacker News

The fish shell is amazing

rmpr.xyz

191–200 of 302 posts

Re: The fish shell is amazing

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

[deleted]

Re: The fish shell is amazing

#192
post #143

Anyone else read that as “The fish smell is amazing”?

I just did - and then I opened the article and kept reading...

> I’ve been lurking the fish smell for a couple of years now (and the nushell but it is another story for another time). Not so long ago, I decided to try it, and it’s simply… amazing.

..., had a "wtf"-moment (I thought that "nushell" was some kind of clam - my mothertongue is italian), then I read what followed so I started over paying more attention to what was written. I had to laugh :))

Re: The fish shell is amazing

#193
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…

> 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 you end up with a simpler, faster, more maintainable shell.

Re: The fish shell is amazing

#194
post #160

Earlier quoted context omitted.

Of course you could always just do ctrl+r and cycle through and refine suggestions in bash

The Fish suggestion the GP is describing isn't based on history, although it also autocompletes from commands in your history that way. That's part of the baseline autocompletion functionality of the whole shell, for all command names, local files, etc.

Expanding on the local file competition: this is even context aware in some cases!

If you have four files starting with "A", one of which ends in .gz, typing "gunzip A" will suggest the .gz file.

Likewise for things like "git add" - as soon as you type an identifiable prefix to a changed file it will be suggested (eg if you only have one changed file in src/ it will suggest that when you type git add src)

Re: The fish shell is amazing

#195
post #60

Earlier quoted context omitted.

> what do you like about Nu shell specifically? A whole bunch of things: 1. abandonment of POSIX shell syntax. We can do better. I'm happy with Zsh being POSIX-compatible, and that will always be there. 2. a focus on structured data. Nu basically has hierarchical dataframes built-in, along with lots of facilities for their manipulation. There have been a few other attempts at this but the benefits are obvious. Rather…

> A whole bunch of things: I appreciate the clarity of your message... curiously enough all the things that you mention I see them as anti-features of nushell (except the first one) 1. Posix shell is clunky has its limitations but there's nothing really flawed about it. It is nice to have non-posix shells, though; in that I agree with you. 2. I hate hate hate the very concept of dataframes. They seem like a useless o…

> Posix shell is clunky has its limitations but there's nothing really flawed about it.

I think shellcheck is the best argument against this. POSIX shell is just stuffed to the brim with weird gotchas, places where the obvious way to write something causes subtle bugs down the line.

It's the only programming language I use that feels adversarial, where you have to be paranoid to properly solve simple tasks. (Admittedly some of that is because of the reliance on system programs rather than the shell language itself.)

Re: The fish shell is amazing

#196
post #118

Specific question for anyone who's gone from bash to fish (and maybe back) -- Does the "only splitting on newlines" mess you up? I've just been in bash so long that I feel like this will get me?

You mean not splitting on spaces?

No, never, ever bit me.

Re: The fish shell is amazing

#197
post #166
post #158

Earlier quoted context omitted.

Now that you say that, that's funny as I do not have to exit twice. I don't know why though as it seems that it should be the case.

Does your profile call `exec fish -i` rather than just `fish -i`? In that case, you'll only exit once :) From the `exec` manual: If exec is specified with command, it shall replace the shell with command without creating a new process. If arguments are specified, they shall be arguments to command. Redirection affects the current shell execution environment. https://man7.org/linux/man-pages/man1/exec.1p.html

I do `exec fish` indeed, so that's the reason.

Re: The fish shell is amazing

#198

I like software where you don't need to spend hours or even days on configuration and it just works out of box. Unfortunately the different syntax is no go for me. I have a bunch of scripts which I can run on my local machine and remote interchangeably. Even if syntax is better I want to learn rather `one syntax` that work everywhere. But that is only one thing that prevents me from trying it.

Just invoke your scripts with sh or bash

I basically always do that anyway. I never get around to working them executable so I just do

bash foo.sh

Which is actually easier to type than

./foo.sh

Re: The fish shell is amazing

#199
post #162

Is there a reason fish isn't posix compliant? From my experience (which is rudimentary tbf) there are only detriments due to the lack of sh scripts not working out of the box.

The reason is that POSIX shells are ugly and stupid, and fish syntax fixes (some of the) fundamental errors made in Bourne shell. Things like "${args[@]}" and other quoting and array-expansion syntaxes should not exist. Subshells are difficult and surprising. Weird keywords (esac) are weird. Note how Plan 9 rc is also not POSIX. Shell scripts have shebangs and work.

> Shell scripts have shebangs and work.

Exactly this - I feel like it is a common misconception.

Even without shebang? `bash the_thing.sh` -> done.

Writing a personal utility for myself? Unless it is dead simple I'll go with fish. It'll work with spaces in file names by default, I won't need `while Writing anything I need to distribute? sh or bash

I've been using fish for years and years and never once have I thought "oh man I wish this was POSIX" because POSIX was always 3 key strokes away if I really needed it: `sh` (which, I did not, unless I had to write a portable script and needed a repl)

Re: The fish shell is amazing

#200

Earlier quoted context omitted.

I moved from bash => zsh => fish. I wanted reasonable features on my shell, and fish was much faster and needed almost no plugins. The fact that I can write a simple for loop without needing to look up how to do it by far beats the POSIX compatibility, if I need it I can still write a bash script, but when using the shell I don't need to recall where semicolons or `do`, brackets (and how many) go.

> I moved from bash => zsh => fish Did the same, but moved on. Now it is: bash => zsh => fish => nu

What did you prefer about nu?
Post reply on HN