Fish Shell 3.5.0(fishshell.com)
fishshell.com
Fish Shell 3.5.0
https://fishshell.com/docs/current/relnotes.html#fish-3-5-0-released-june-16-2022
73 comments
> If you love bash or zsh, and are in the habit of building long complex commands on the command line, then stick with bash or zsh.
Fish handles this very ably as well, of course! If you're a developer and you work in or deploy to a lot of environments where you can't install software, choosing what comes with the environment makes sense. But even when it comes to scripting, you won't regret sticking with Fish, imo.
Fish handles this very ably as well, of course! If you're a developer and you work in or deploy to a lot of environments where you can't install software, choosing what comes with the environment makes sense. But even when it comes to scripting, you won't regret sticking with Fish, imo.
If I'm not a "power user" (learned rudimentary bash as teenager, stuck with it on MacOS through college) is it worth it to learn a new shell?
I respect the craftmanship, but if I'm more of a "software carpenter" why should I invest the time?
I respect the craftmanship, but if I'm more of a "software carpenter" why should I invest the time?
Yes, it's worth it! Fish is especially great for users who have found learning bash troublesome or uninviting. It's simpler and easier to learn, and plus it has very pleasant defaults and builtins. If you get started with Fish, you're much more likely to learn advanced functionality because the journey is more enjoyable than with bash.
For me, fish made my life instantly better without any real investment coming from bash. There are some incompatibilities, but I felt productive right away.
I always recommend fish to anyone who doesn't (yet!) have strong opinions about their shell.
Immediately seeing if you misspelled a command because the color changes is a huge benefit if you're not super familiar with the command line.
The auto-complete and suggestions are also miles better than bash - they are automatically generated from man pages, so most commands have a usable set of completions.
The web-based config lets you easily tweak settings that would otherwise be an incomprehensible soup of PS1=3!@*(!@!@ gobbledygook.
Also, it mostly "just works" out of the box, so you really don't have to waste any time setting anything up if you don't really care.
Immediately seeing if you misspelled a command because the color changes is a huge benefit if you're not super familiar with the command line.
The auto-complete and suggestions are also miles better than bash - they are automatically generated from man pages, so most commands have a usable set of completions.
The web-based config lets you easily tweak settings that would otherwise be an incomprehensible soup of PS1=3!@*(!@!@ gobbledygook.
Also, it mostly "just works" out of the box, so you really don't have to waste any time setting anything up if you don't really care.
Sounds promisingm, especially now that macOS defaults to Zsh... I very rarely see any documentation where that is the default.
> The auto-complete and suggestions are also miles better than bash - they are automatically generated from man pages, so most commands have a usable set of completions.
I never understood this. It's always seemed worse - in bash/zsh I can tab complete branches/tags etc in git, pods/deployments etc in kubectl. I try that in fish and it'll just list files in my PWD
I never understood this. It's always seemed worse - in bash/zsh I can tab complete branches/tags etc in git, pods/deployments etc in kubectl. I try that in fish and it'll just list files in my PWD
Fish to me is like writing a document in Word. Bash is more like writing it in Notepad. (or whatever Linux equivalent you want to use)
Though I still write my scripts as bash scripts (with shebang as the first line).
Though I still write my scripts as bash scripts (with shebang as the first line).
I used zsh for years with a moderately elaborate configuration that grew into a pain in the ass to manage. I started using fish a few months ago with no configuration of my own. I'm still not sure if I'll stick with it in the long run, but if nothing else it's a welcome reprieve.
The auto-completion alone is worth it IMO. I've been using fish for 6 or 7 years now, and having it hint ahead some obscure command that I only use once a month saves me so much time reading MAN/searching online.
Pair that with tldr and it's a really good experience.
Pair that with tldr and it's a really good experience.
jakobov(1)
Been meaning to move fully to Fish, was just dreading the amount of zsh functions I'd have to rewrite.
Is there any reason to use Zsh at this point over Fish?
Is there any reason to use Zsh at this point over Fish?
I used fish for a long time, but lost patience with the incompatibility with other shells. It’s nice to be able to just paste and run someone else’s command, and I eventually tired of having to rewrite every command to use fish syntax. For example, replacing FOO= with set - x …
The reverse is even worse—if I need to send someone a command to run, I have to rewrite it in a syntax that’s likely to work when they run it. It only takes a few seconds each time but I grew weary of it.
They have improved compatibility a lot.
Also, you could do what I do: leave bash or something else as the default, and then just run fish manually.
Then if I have a problem pasting or something I run type exit.
But the incompatibilities are a lot less now.
Also, you could do what I do: leave bash or something else as the default, and then just run fish manually.
Then if I have a problem pasting or something I run type exit.
But the incompatibilities are a lot less now.
You can just do `bash -c "CMD"`.
occasionally you'll need to run a command which sources or exports… it's no silver bullet in my experience anyway
Check out fish-foreign-env, bass, and babelfish
create a key-binding to invoke your terminal with bash. I have not set fish as my system shell (aka chsh)
That’s accepted now, and was always available by prepending env.
I was in a similar situation 2 years ago and I took the plunge. Turns out, the amount I had to rewrite was fairly minimal, and the benefits of Fish are just incredible. I'd say: go for it, you won't regret it!
Personally, I'm a lover of subshells, I often write things like (cd mydir && make), making use of the fact the 'cd mydir' only happens in the subshell.
Fish doesn't have anything like that, there are a few workaround, but none of them are (in my opinion) anywhere near as nice.
Fish doesn't have anything like that, there are a few workaround, but none of them are (in my opinion) anywhere near as nice.
You should instead
pushd /my/path && command && popd
Both in bash AND in fish!the problem with that is I ended up in the wrong directory if I press ctrl+c, or in the exact examples you give, if command fails.
If it's just make you're doing that for "make -C mydir" does that and puts you back in the original directory when it's done.
I do this too (in zsh), but maybe writing a function callable like this would work:
with mydir make
Although you'd want to be able to write things like with mydir make && ./bin/myprog
and parse everything to the right of `mydir' as a shell pipeline. That might be the sticking point in fish.zsh has survived for longer (it's "Lindy") and is therefore more widely available on remote machines. Also, maybe just my problem, but I do get frustrated having to switch back to bash/zsh syntax and semantics in cases where Fish isn't available, or when writing scripts others will use. Easier for me to stick with zsh for my shell and bash for shipping shell scripts.
zsh tends to actually run scripts when you feed them. As long as you can resist the urge to run all of your POSIX scripts in fish, I think I much prefer fish as an interactive shell.
Exactly. Falling back to Bash to run scripts makes life easier. Just add a Bash shebang at the top and you're good to go.
Last time I looked into switching the vim mode in zsh was better by enough of a margin that I didn't switch, but that was years ago. I've been meaning to give fish another shot.
You can 1. Make your scripts executable or 2. Use bash / zsh inside of fish. 3. You can define wrapper functions in fish that just call bash/zsh functions internally.
I use fish, although I hate writing scripts in it. It just feels wrong. Better stick to good old bash.
For copying and pasting while preserving environments, you can always use `exec` as an escape hatch.
exec bash
<paste some bash>
exec fishprocess substitution?
fish: Invalid redirection target: yq3 r <(kubectl get nodes -o yaml)
fish: Invalid redirection target: yq3 r <(kubectl get nodes -o yaml)
You can do process substitution by piping into the psub command ;)
Does process substitution work correctly yet?
The -f flag doesn't support parallelism, and the -F flag deadlocks.
> Added completions for:
> archlinux-java (#8911)
> apk (#8951)
> brightnessctl (#8758)
> efibootmgr (#9010)
> fastboot (#8904)
> optimus-manager (#8913)
> rclone (#8819)
> sops (#8821)
> tuned-adm (#8760)
> wg-quick (#8687)
One of my favorite things about fish is that it bundles completions for a huge number of packages. My experience with bash was that completion support was very spotty
> archlinux-java (#8911)
> apk (#8951)
> brightnessctl (#8758)
> efibootmgr (#9010)
> fastboot (#8904)
> optimus-manager (#8913)
> rclone (#8819)
> sops (#8821)
> tuned-adm (#8760)
> wg-quick (#8687)
One of my favorite things about fish is that it bundles completions for a huge number of packages. My experience with bash was that completion support was very spotty
Zsh Completions is a pretty good alternative for anyone using zsh.
https://github.com/zsh-users/zsh-completions
https://github.com/zsh-users/zsh-completions
Zsh completions can be hit or miss. Sometimes they make huge differences to how path argument selection works (tab completion) in confusing ways that are inconsistent between commands.
Great! Love the new Astronaut prompt. I dabbled with starship.rs, and really liked the prompt, but ultimately didn't want to deal with an extra moving part in my terminal setup. I'm so happy that some of it is available in stock fish shell, now.
I love fish, it's become my main daily driver. :)
I really love fish and used it daily for many years. Then I started work at a new company that had an existing library of internal shell tools that weren't compatible with Fish and the effort to port them was too much.
I found that ZSH managed with OhMyZSH plugins gets me similar functionality without the syntax incompatibilities. Unfortunately unless Fish moves back towards compatibility I don't see myself ever going back, it's just too much hassle dealing with little syntax issues all the time.
I found that ZSH managed with OhMyZSH plugins gets me similar functionality without the syntax incompatibilities. Unfortunately unless Fish moves back towards compatibility I don't see myself ever going back, it's just too much hassle dealing with little syntax issues all the time.
I’m an avid bash user for the same fear of incompatibility. But how does that work in practice? I mean- if I use Fish shell interactiveley, how does that affect shell scripts? I presume they would still be run via bash (#!/bin/bash)
Executing programs (including scripts, which are indicated by shebangs like #! /bin/bash) is the operating system's responsibility, not the shell's.
So yeah, shell scripts work exactly the same if you're running them as an executable. Some scripts, however, (like for instance .bashrc) are intended to be sourced by the shell rather than invoked as an independent executable. These won't work, and will need to be ported.
So yeah, shell scripts work exactly the same if you're running them as an executable. Some scripts, however, (like for instance .bashrc) are intended to be sourced by the shell rather than invoked as an independent executable. These won't work, and will need to be ported.
Could be "add source /blah blah" to your bashrc, and this adds some shell functions (which allow it to do stuff like cd).
Every script should have a #! line, but if it doesn't, you can always run it with `bash <script>`.
Why did you need to port them? The occasional simple shell script I write in bash. You can just use fish interactively.
Same here, fish is amazing until is isn't.
I really wish it was POSIX
Ditching some of the POSIX missteps is half the appeal of fish.
I'm running fish for at least 8 years now and I'm very happy with the out of the box experience. It's one of the first things I install on new machines.
> ampersand-nobg-in-token, which means that & will not create a background job if it occurs in the middle of a word. For example, echo foo&bar will print “foo&bar” instead of running echo foo in the background and then starting bar as a second job.
Yes! This has been annoying with curl for a long time.
Yes! This has been annoying with curl for a long time.
Since such URLs very often come from copy & paste another way to deal with this is smart auto-quoting when a paste is detected via the "bracketed paste" feature of modern terminal emulators. zsh does this if you enable url-quote-magic.
Fish also enables bracketed paste and does smart escaping when you paste inside single-quotes.
(I'm a fish developer)
(I'm a fish developer)
A whole recent kettle of them:
3 months ago, 90 comments https://news.ycombinator.com/item?id=30734072
3 months ago, 20 comments https://news.ycombinator.com/item?id=30660587
7 months ago, 291 comments https://news.ycombinator.com/item?id=29341390
3 months ago, 90 comments https://news.ycombinator.com/item?id=30734072
3 months ago, 20 comments https://news.ycombinator.com/item?id=30660587
7 months ago, 291 comments https://news.ycombinator.com/item?id=29341390
I used to like fish, but because of compatibility issues, I went back to OMZ (:
Have you tried it recently? It's gotten a lot better. The following commands used to not work, but now they all do:
true && echo hi
false || echo hi
export VAR=1
VAR=1 somecommand
echo "$(echo substitution)"This killed all shell interaction within my tmux setup, somehow, and I had to downgrade in osx/brew [1] back to v3.4.1 [2]. I'm still wondering what part of my (probably outdated) tmux config caused it, but the most suspicious part is the run-shell/if-shell stuff.
Anyway, have things to do before I can try again and dig in. Thought I'd post in case someone else ran into this.
[Edit] Tip: swap to a different shell before uninstalling your current shell. Sigh...lol
[1] https://github.com/fish-shell/fish-shell/issues/5497 [2] https://raw.githubusercontent.com/Homebrew/homebrew-core/ad5...
Anyway, have things to do before I can try again and dig in. Thought I'd post in case someone else ran into this.
[Edit] Tip: swap to a different shell before uninstalling your current shell. Sigh...lol
[1] https://github.com/fish-shell/fish-shell/issues/5497 [2] https://raw.githubusercontent.com/Homebrew/homebrew-core/ad5...
Hello, fish shell dev here. We opened an issue on our tracker - when you get a chance we'd appreciate if you'd share some tmux logs there, as I wasn't able to reproduce with your config file.
https://github.com/fish-shell/fish-shell/issues/9019
https://github.com/fish-shell/fish-shell/issues/9019
[Late Update]
The fish 3.5.0 release is not responsible for my tmux issue. False alarm.
Downgrading did somehow help me regain shell interaction, but I can't create a new session/pane, etc.
I think something else broke my tmux setup during the brew upgrade, or possibly even before it.
The fish 3.5.0 release is not responsible for my tmux issue. False alarm.
Downgrading did somehow help me regain shell interaction, but I can't create a new session/pane, etc.
I think something else broke my tmux setup during the brew upgrade, or possibly even before it.
Would you mind posting a link to your tmux config? I'd look into it.
Thank you in advance!
tmux.conf [1]
[1] https://gist.github.com/alexpw/7d406734f912f835d705066de8286...
tmux.conf [1]
[1] https://gist.github.com/alexpw/7d406734f912f835d705066de8286...
If you love bash or zsh, and are in the habit of building long complex commands on the command line, then stick with bash or zsh. But if you are just running commands fish is far superior. If you are not a bash/zsh/posix expert fish is a cleaner language and you'll learn it more easily. A fully tricked out zsh might do everything that fish does, but it is very slow compared to fish.