Live data from Hacker News

The fish shell is amazing

rmpr.xyz

161–170 of 302 posts

Re: The fish shell is amazing

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

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…

Exactly this.

I script in bash (though I'm super interested in oil), and use fish as my interactive shell, it's pinned to screen 0 in my screen session.

Re: The fish shell is amazing

#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.

Re: The fish shell is amazing

#163
post #82

Earlier quoted context omitted.

Oh wow...finally someone is bringing the great ideas of Powershell to unix. Can't wait to see how this turns out.

You can run PowerShell on Unix already, but imo it is too slow for interactive use. Getting it to act like a Fish makes it very, very slow

I can't imagine it being any slower then it already is out of the box.

Re: The fish shell is amazing

#164

> You can configure your shell using a web interface! Just run fish_config As much as I like the fish shell, I really consider this an anti-feature. A TUI application to configure the shell would make much more sense. The terminal emulator is your platform, not the Web.

The web configurator is a practical feature. I just tried it and it seems to work pretty well. But you're in luck; looks like the next version will have everything also configurable via text: https://github.com/fish-shell/fish-shell/issues/3625

That's a CLI, not a TUI, but it is awesome that they've now made the CLI configuration worflow feature-complete!

Re: The fish shell is amazing

#166
post #158
post #148

Earlier quoted context omitted.

That would be a nightmare for sure. I can't blame you for being cautioned by an experience like that. I've been running Fish as my login shell for almost 10 years now, on Linux and then additionally for ~4 years for intermittent macOS usage (only at work) without issue. I don't really like launching Fish from ~/.bash_profile because or similar because I don't like having to type `exit` twice to exit, and `exec`ing in…

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

Re: The fish shell is amazing

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

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.

Is it that hard to remember a bash for loop?

  for i in $(seq 1 10)
  do echo $i
  done
Then you can just replace new lines with ; if writing a one liner.

  for i in $(seq 1 10); do echo $i; done
I guess it isn't as simple as python

  for i in range(10): print(i)
but it's pretty close aside from the variable binding.

Re: The fish shell is amazing

#168

I started a new job recently, and I've been thinking about terminals and shells. I love a well configured modern env, but I can't be bothered spending the literal HOURS you need to setup everything... zsh, zsh plugins, fzf, fzf plugins, fd, dot bare, patched fonts, 24 bit terminal color, temrinal color theme, binutils color theme, powerline, diff-so-fancy... I get that the devil is in the details, but come on, can I…

I agree with you here. I am like a terminal nomad, I have of course my own computer but there are so many other computers I log in to over the course of my career. They usually have bash and I have learned to just like that. I don't want to maintain one habit for my pet computer, and another when I am a nomad.

Re: The fish shell is amazing

#169
post #82

Earlier quoted context omitted.

Oh wow...finally someone is bringing the great ideas of Powershell to unix. Can't wait to see how this turns out.

You can run PowerShell on Unix already, but imo it is too slow for interactive use. Getting it to act like a Fish makes it very, very slow

But I think it's quite good for scripting. You can call any system command as easily as in bash while being able to use variables for not just strings. I'd never use it as interactive shell, of course :]

Also... the script will then run only on my machine as most Linux systems don't have powershell and most Windows don't have the Unix commands I still use all the time.

Re: The fish shell is amazing

#170

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.

Is it that hard to remember a bash for loop? for i in $(seq 1 10) do echo $i done Then you can just replace new lines with ; if writing a one liner. for i in $(seq 1 10); do echo $i; done I guess it isn't as simple as python for i in range(10): print(i) but it's pretty close aside from the variable binding.

  for i in {1..10}
Post reply on HN