6 ms·
Would anyone care to take the time and explain what Fish does differently to zsh or bash? I like hearing the HN perspective.
by bloopernova 3y ago
Would anyone care to take the time and explain what Fish does differently to zsh or bash? I like hearing the HN perspective.
- TheAceOfHearts 3y agoIt has a lot of sensible defaults out of the box, and the scripting language is less esoteric than bash. I'd go into more detail but it has honestly been nearly a decade since I switched, so I barely remember. From what I recall, you can setup bash or zsh to do most of the same things, but that requires addons or tweaking configurations. With fish you just get a sensible shell right out of the box.
- nirvdrum 3y agoWriting fish completions is really easy, too. I never bothered when I used Bash, but I write them for various utilities in Fish and it makes the shell more pleasant to use. Several of my custom ones have been supplanted by upstream completions having been added in a subsequent releases.
- foobarian 3y agoHow is history recording in fish? I found that keeping an eternal history tagged with screen session ids is a huge productivity boost in my bash setup and hoping to see if it's feasible in other shells.
- e12e 3y agoCould you expand on?: > ... tagged with screen session ids
- foobarian 3y agoI set a unique session ID in screen sessions, which get recorded in history, which lets me resume the session history streams across reboots/screen restarts.
- alwillis 3y ago> How is history recording in fish? I'd say it's pretty good; history gets saved in a human-readable format (YAML) in $XDG_DATA_HOME, which is configurable. A feature I really like: when retrieving completions from history, Fish shows the commands that occurred for the particular directory you're in. Searching history is also nice [1]. [1]: https://fishshell.com/docs/current/interactive.html#history-search https://fishshell.com/docs/current/interactive.html#history-...
- katspaugh 3y agoA fish user for the last few years here. Fish is all about contextual autocomplete and zero configuration. It just works out of the box. It suggests completions as you type and the experience is very smooth. Unfortunately the scripting language isn’t sh-compatible but it’s fine as you can still run scripts in bash.
- Aloha 3y agoI love fish for an interactive shell, while continuing to use bash for scripting, it gives me the best of both worlds.
- kemotep 3y agoFrankly I use python and PowerShell (to control Windows boxes) for scripting 99% of the time and a quick `#!/usr/bin/env bash` shebang on top is how I learned how to bash script anyway since Debian was/still uses Dash for /bin/sh Fish really is what it says on the tin: Friendly Interactive Shell. Easily get 90% of the benefits of zsh with just a install and chsh.
- andatki 3y agoI was able to adopt fish shell and get many features from bash that were provided from plugins. I prefer the more “stock” shell configuration for easier maintenance across computers and over time, and a less complex dotfiles project. https://github.com/andyatkinson/dotfiles https://github.com/andyatkinson/dotfiles On a team I limit my fish shell use to my own machine though, and would use bash for scripts to share with a shebang line. I also switch to a bash shell when needed.
- flohofwoe 3y agoThe big thing for me was the intuitive auto-completion which I hadn't seen anywhere else at the time, but this is now also available in zsh via this plugin: https://github.com/zsh-users/zsh-autosuggestions https://github.com/zsh-users/zsh-autosuggestions
- yjftsjthsd-h 3y agoTLDR: Fish throws out old stuff (sh compatibility, mostly) in order to be very user friendly (at least to users who aren't used to sh), and is very good at doing so. (Written as a user who is very accustomed to sh and gave up after trying fish briefly)
- stouset 3y agoAs a counterpoint, after 15 years of being proficient in bash, the second I tried fish I never looked back. There are a few minor differences in scripting that I had to figure out when I ran into them (while/if syntax, process substitution, some other minor things), but these were small enough that it didn’t matter. I’ve had multiple coworkers with a similar experience.
- jrpelkonen 3y agoI switched to fish a few years ago as well. Great productivity boost for very little fuss. I still write my scripts in bash, though. I feel it’s counterproductive to expect the script user to download fish when bash is already preinstalled nearly everywhere. If someday fish reaches similar penetration I’ll reconsider.
- stouset 3y agoI do also still write my scripts in bash, but sometimes you are doing interactive work and need to know the syntactic differences.
- yjftsjthsd-h 3y agoTo be clear, I intended my comment to either be neutral or an endorsement of fish. I found it too painful to bother with, but I'm unusually attached to sh.
- heads 3y agoBoth zsh and fish offer the same kinds of improvements over bash. The headline feature of these two is the auto completion user experience. They complete as you type, with fish for example showing suggestions in a muted colour ahead of your cursor which you can complete word by word or accept completely. zsh is a much older project and carries with it a lot of baggage in terms of configuration. fish was designed later and straight out of the box. Intelligent auto complete is extremely useful if you are constrained with your input either by disability or by using a suboptimal device. Switching to fish really helped for ssh-ing to hosts from my iPhone.
- 9dev 3y ago> Intelligent auto complete is extremely useful if you are constrained with your input either by disability or by using a suboptimal device. Well, assuming you’re a hyper-intelligent being with eidetic memory, that is. The main value of the intelligent completions isn’t conserving keystrokes, but discoverability of input options. It’s the same story for IntelliSense in IDEs.
- lupusreal 3y agoI used to have an elaborate zsh config but I got tired of maintaining it so I switched to fish. Fish has the most "modern" default configuration of any shell I've seen, so with fish I'm satisfied without needing to maintain configuration.
- JTyQZSnP3cQGa8B 3y agoThat or https://www.nushell.sh/ https://www.nushell.sh/ which seems to be more interesting as it could be an equivalent to PowerShell for Unix.
- mekster 3y agoDo note some shell scripts won't work by pasting as is. You might need to put it through sh or bash interpreter instead. fish is good for a shell but for scripting, probably better to stick to bash for portability. People tend to treat both the same. On the other hand, most if not all of fish capability can be accomplished via zsh plugins while retaining shell script portability to a decent extent to bash.
- 9dev 3y ago> On the other hand, most if not all of fish capability can be accomplished via zsh plugins while retaining shell script portability to a decent extent to bash. …if you don’t mind wasting your time on reinventing the wheel, that is. You get a lot of added benefit, for free, by using Fish. For that cases where you need to follow instructions in bash, just drop into a bash session.
- alwillis 3y ago> explain what Fish does differently to zsh or bash Fish adds a bunch of features that, when you think about it, should have been standard a long time ago… like creating auto-completions from man pages, syntax highlighting on the command line and 24-bit color out of the box. Little things like providing autocompletion of targets if you happen to be in a directory with a Makefile and autocompletion for apt, rpm and yum package managers. macOS users: Fish can autocomplete brew [0] commands and packages too. Super handy. As I often see on HN, yes, you can plugin and script your way to adding these features to Bash and Zsh; the beauty of Fish is you get all of this out of the box without having to configure anything. Bash and Zsh plugins require another layer of management and (often) slow things down. It's one of the first things I install on a new Mac and have made it the default on my FreeBSD machines as well. Developer Brett Terpstra has a blog post series [1] about going from Bash to Fish; reading this helped me take the plunge. If you're a Bash enthusiast as Brett is/was, make sure to read his first article "Branching out from Bash: Fishing expedition" [2]. [0]: https://docs.brew.sh/Shell-Completion#configuring-completions-in-fish https://docs.brew.sh/Shell-Completion#configuring-completion... [1]: https://brettterpstra.com/topic/fish/ https://brettterpstra.com/topic/fish/ [2]: https://brettterpstra.com/2019/10/11/branching-out-from-bash-fishing-expedition/ https://brettterpstra.com/2019/10/11/branching-out-from-bash...
- huijzer 3y agoThe best way to understand is probably to try it. I feel lost whenever I‘m outside a Fish shell. Other shells don’t provide as much immediate feedback. I never use it for scripting though. Fish script language is about as unintuitive as Bash, so I rather stick to Bash.
- paradox460 3y agoFish more or less just works. It has a lot of sensible defaults out of the box, and you can be extremely productive with it right off the bat. It also forgoes compliance with POSIX intentionally, with the rationale that POSIX can sometimes be an obstacle. So you get things that are dramatically better than how they work in other shells, like the prompts. Instead of injecting stuff into envars, you just make a function that echos your prompt out. Same goes for right prompt and most of the other configuration stuff; its all function driven