25 ms·
The fish shell is amazing
- rgoulter 5y agoNot restricted to fish shell, but I can further recommend starship.rs as a prompt, and using fzf to search through command history.
- pletnes 5y agoFzf can search virtually anything, since you can pipe output into/through it. It’s fantastic.
- iamevn 5y agoI'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.
- pxc 5y agoScripting 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.
- emersion 5y ago> 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.
- jvolkman 5y agoThe 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 https://github.com/fish-shell/fish-shell/issues/3625
- pxc 5y agoThat's a CLI, not a TUI, but it is awesome that they've now made the CLI configuration worflow feature-complete!
- octet1 5y agoWondering how it would function after being passed through https://github.com/azproduction/html-tui https://github.com/azproduction/html-tui
- BeetleB 5y agoxonsh is also worth a try. I've been using it for a few years now.
- slifin 5y agoFish is so good I think I'm using shellder and some other bits But I just use it as a way to run commands, and I use dynamic languages to create scripts just not bash..
- vander_elst 5y agoVi mode was not good enough: first thing I do in a new shell is `set -o vi` and then try to do simple things: replace parts of words, copy/paste, search history. Fish in my experience was way worse than zsh and bash. Maybe things changed in the meantime?
- xhevahir 5y agoCan anyone explain why getting similar functionality in zsh is such a PITA? Every time I've tried to get smart-autocomplete history stuff working in it I've given up. Is it because the community is much more fragmented?
- uncomputation 5y agoI really liked fish when I used it but unfortunately the non-compliance with other shells is just too much hassle given the feature set (autocomplete is cool but I always know when I have python3 vs python4), like not being able to just copy paste “export VAR=…” from the web like I have been my whole life.
- dirkg 5y agoIs fish usable for a web/nodejs developer working with the usual libs in the JS ecosystem such as React/Webpack as well as usual github projects? By that I mean any scripts included in these projects. I have seen only a few scripts though.
- pvaldes 5y ago> fish is not POSIX compliant, don’t expect your previous scripts to work at all Extend, embrace, extinguish?...
- purerandomness 5y agofish never claimed to be POSIX compliant to begin with, so no. There never was an 'extend' step.
- pvaldes 5y agoBut seems to want us to replace the old reliable shell with it (Or this is what I understand). I see a lot of people reinventing the wheel in Linux and trying to appeal the new users. What you have in the end is normally worse than the standard ones. Is just dissecting Linux in a lot of smaller particles and smaller rooms. So thanks, but not thanks. Not to me. Wouldn't be much more practical to use all of those talent and ideas to help to improve the extant bash shell instead?
- Shared404 5y agoSometimes to improve on old ideas or develop new ones you need to start over. See plan9, RedoxOS, TempleOS, Gemini, etc. None of these are currently in a position to gain dominance, but they all explore a space that couldn't be explored starting with a prior code base.
- woodruffw 5y agoThere are lots of "old reliable shells" that are POSIX incompatible. (t)csh[1] is the first family that comes to mind. The EEE analogy is more applicable to GNU Bash anyways: it extended the POSIX sh baseline with a bunch of GNUisms that a lot of "POSIX" sh scripts now unintentionally use. [1]: https://en.wikipedia.org/wiki/C_shell https://en.wikipedia.org/wiki/C_shell
- adrian_b 5y agoI do not think that there are many GNUisms in bash, even if indeed there are a few optional syntax variants that should be avoided for compatibility with other shells. In any case I am not aware of any GNUism that is actually useful in scripts, so taking care to not use any syntax variant specific to bash is not a problem. All the important bash features that are not POSIX are not GNUisms, but they are: 1. The 50% of the new ksh 1988 features that have not been included in the POSIX shell, e.g. condition testing "[[ ... ]]" and arithmetic testing "(( ... ))". 2. All the new features added by ksh 1993, none of which have been included in POSIX, e.g. "for (( ... ))" and the extra parameter expansions that replace the most common invocations of sed or awk. 3. The brace expansion from csh 4. The extended brace expansion forms added by zsh (which generate arithmetic progressions and are usually preferable to "for ((...))") Attempting to write POSIX-compliant scripts in 2021, i.e. not using these extra ksh/csh/zsh features provided by bash, is a huge mistake in my opinion, because without these features any non-trivial script becomes much longer and much more error-prone. The Google recommended style for shell scripts (https://google.github.io/styleguide/shellguide.html https://google.github.io/styleguide/shellguide.html), which is based on using all bash features, is pretty decent. It is far less work to ensure that bash or ksh/zsh exists on any target system than to maintain any obsolete POSIX-compliant scripts (which are stuck to the 1979 Bourne shell features + only half of what ksh 1988 has added).
- deleted 5y ago[deleted]
- jonfw 5y agoI 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 ever has
- rainingmonkey 5y agoPOSIX compliance has never brought me any issues, if I want bash syntax I just use `bash -c COMMAND`. You can invoke bash scripts with `bash SCRIPT` or just add the bash shebang `#!/bin/bash` to the top of your script, set the executable bit and invoke directly.
- jscheel 5y agoThis is my problem as well. I’ve been using fish for quite a long time, and I’m still frustrated by weird posix incompatibility.
- lovelyviking 5y ago>I’m still frustrated by weird posix incompatibility. Can you also share what are the most significant problems with posix incompatibility for you? Why is it a problem?
- mey 5y agoThe one I see is really, all of Linux vs OSX/MacOS. And which version of Bash is shipped by default. Internally we have a boot strap run book developers/operations to bring up either Windows/WSL or MacOS to a consistent shell env.
- preseinger 5y agoThis shouldn't be an issue! Shell scripts begin with e.g. #!/usr/bin/env bash which means the interactive environment is irrelevant. Users of nonstandard shells like fish need to learn a bit of on-the-fly translation if they expect to copy/paste into their terminals, but it isn't too onerous.
- cbzehner 5y agoI used Fish for several years before switching over to nushell a few weeks ago. Nushell takes the ideas behind Fish even further by incorporating types other than strings and adding more built-in functionality that’s useful for your average command-line user. I doubt I’ll go back but both are great! Highly recommend Fish and Nushell!
- bobbylarrybobby 5y agoDoes nushell have the same kind of autocomplete? That’s what really keeps me using fish
- pxc 5y agoNo, at least not out of the box, on Nushell 0.39.0. Just tried it and there's no - out-of-order tab completion - preview with left/right arrow completion - case-insensitive/smart-case completion
- assbuttbuttass 5y agoFish really shines in interactive use, like being able to write fish_vi_key_bindings, and that setting is preserved after restarting fish. Or using funced and funcsave to modify helper scripts, or abbr -s ... I'm not sure I've ever opened my fish config file, but I'm still able to customize it easily
- nojito 5y agoFish is good, but most shells pale in comparison to powershell unfortunately.
- philipswood 5y agoPowerShell: Maybe the learning curve is steep or something, but the times I've had to use it I disliked it. I want to like it. It's goals and purposes seem to be in the right place, but.... Nope.
- deleted 5y ago[deleted]
- pxc 5y agoPowerShell is definitely way more capable a scripting language, but it pales in comparison to Fish when it comes to speed, ease, and pleasantness of interactive use. There's a new generation of shells on the rise which look up to both Fish and PowerShell as models of different virtues they want to embody. A lot of them are already usable, and some day a few of them will be killer apps for developers and sysadmins
- nojito 5y agoNothing is speedier, easier, or more interactive than Get-Help in Powershell. https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/get-help?view=powershell-7.2 https://docs.microsoft.com/en-us/powershell/module/microsoft... Using other shells is like living in the stone age. I don't know why people would do that to themselves.
- pxc 5y agoGet-Help is pretty good, but I don't like several things about it: 1. You have to go out of your way to fetch the full help pages on a given PowerShell installation (they're not stored locally by default). 2. Even after you fetch the full help, not all of it is actually included in the Get-Help output (IIRC examples), so you often need to use `Get-Help -Online`, which opens a separate application (browser) and that sucks 3. Inside the terminal, there's little to no special formatting or syntax highlighting, unlike what you get with a good `man` pager 4. Get-Help output (unlike `man` output as configured on most distros) is not paged by default. `man` could be better, and I don't really vibe with `info`, but Get-Help isn't that great imo. The actual content of the help is quite good, and it's nice that it includes examples, but the same is true of most man pages.
- kbd 5y agoAs 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 scripting language in its own right even when not used full-time as a shell.
- sprash 5y agoMany of the features are also achievable with pure bash with ble.sh (https://github.com/akinomyoga/ble.sh https://github.com/akinomyoga/ble.sh).
- deleted 5y ago[deleted]
- gogoyubari 5y agoI 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 much, much harder.
- pxc 5y ago> 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
- pxc 5y agoBle.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.
- stardenburden 5y ago> my grandma was afraid of Linux, until I showed her that fish can autocomplete Unknown user on discord
- ribit 5y agoI really love fish and the philosophy behind it, especially the "configurability is the root of all evil" attitude. Makes for a well though out software that is a true pleasure to use.
- ziml77 5y agoI love that philosophy too. If there's too many knobs to turn I'm going to constantly fiddle with them. The only things in my config.fish are calls to scripts to setup iTerm 2 integration and the Starship prompt.
- thibran 5y agoMost of it is nice, but declaring global variables with 'set -gx FOO 123" sucks. Same for "abbr --add g git", why can't it be just "abbr g git" or "set-global FOO 123"?
- spoils19 5y agoExactly. I know a lot of people will disagree but my advice to more junior guys is always get rid of the toys and learn the tools.
- fouronnes3 5y agoI 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 just have a single "terminal environnement distribution" with sensible defaults and that's it. Something like SpaceMacs/SpaceVim but for all that. I don't want to spend the time configuring and maintaining this wonderful pile of obsolete-and-yet-somehow-still-the-best-we-got technology.
- colelyman 5y agoHave you tried https://ohmyz.sh/ https://ohmyz.sh/ ? It is the closest thing to SpaceMacs/SpaceVim for ZSH that I know of.
- anamexis 5y agoIf oh my zsh is Spacemacs, then prezto is Doom Emacs: https://github.com/sorin-ionescu/prezto https://github.com/sorin-ionescu/prezto
- peakaboo 5y agoJust synk your dot files with your config and a readme for what you need to install. Getting my shell up on a new computer is very fast because of this approach.
- pm90 5y agoThis is why most people have a dotfiles repo in their GitHub.
- BugsJustFindMe 5y ago> most people have a dotfiles repo Most people do not have a dotfiles repo.
- sandreas 5y agoDon't forget that if you use #!/bin/sh in POSIX compatible scripts, you can configure /bin/sh to symlink dash shell instead of bash or zsh. Dash will run scripts way faster (up to 4x) because it is less feature blown... This is the reason, why I try to prevent using bash/zsh exclusive features in my daily use scripts.
- nvllsvm 5y agoI use `#!/usr/bin/env sh` in my scripts to avoid having to overwrite a systems defualt /bin/sh and whatever issues that can result in. Instead, I have ~/.local/bin in PATH with dash symlinked to ~/.local/bin/sh
- londons_explore 5y ago> You can configure your shell using a web interface! Think about that for a while.
- mro_name 5y agoindeed, IMO the biggest downside – the (python-)heavy underpinnings.
- garciasn 5y agoMore and more often, I am getting the following error: Malware and Phishing This site is blocked because it is a known security threat. Please contact your network administrator to gain access. My assumption this is because I have Xfinity Business Class and it's blocking the site. But why would I be seeing this so often on a site linked from HN?
- vorticalbox 5y agomaybe the .xyz domain?
- cpach 5y agoIt could be that the web filter in question has no info about the site rmpr.xyz, and therefore gives it an unfavourable score. You might want to reach out to Xfinity support, or bypass their filter using a VPN or proxy.
- jordiburgos 5y agoNot for me, it breaks the .sh scripts and have to be rewritten.
- dimator 5y agoIt's not intended to run .sh scripts though. This is line saying python breaks .pl scripts.
- ayushnix 5y agoI can't think of a single reason why you'd need to rewrite your POSIX sh or bash scripts to be able to use Fish. The `#!/bin/sh` shebang is there for a reason.
- binarysneaker 5y ago+1. What's the point of a great shell, if I can't run the millions (!!) of existing scripts without refactoring them?! Zsh does the autocompletion just as well, so I'll stick with that.
- thrwyoilarticle 5y agoHere's how you run POSIX code inside a fish shell: bash
- boudin 5y agoYou don't need to rewrite any script as long as your scripts have the correct shebang, those scripts works perfectly. I would strongly not advise to make it the default shell though as this can lead to issues. The way I use it is to have bash as my main shell but my .bashrc starting fish if it's not started explicitly from bash: (it's a trick form arch wiki) if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" ]] then exec fish fi I've been using fish for a long time with this setup and never encountered an issue.
- pxc 5y ago> I would strongly not advise to make it the default shell though as this can lead to issues. I've heard this a lot, but I've been using Fish as my login shell for many years, and it's really not a problem I think maybe some vim plugins call out to your $SHELL or something, but assume that it's bash-like? but I've never run into a serious issue with just using Fish as my login shell
- revscat 5y ago> Smart tab completion not only for the commands but for the arguments as well, and it apparently does that by parsing man pages. And it does this every time you spawn a shell. So if you have set your login shell to fish, then every time you launch a shell it loads all the fish plugins like this one, and that slows it down. And you can’t turn it off, or couldn’t the last time I checked around a year ago. Insult to injury? The PR where this was requested was closed by the devs as “wontfix”. This, and it’s lack of POSIX compatibility, made me switch back to zsh.
- iamevn 5y agodo you have fish_update_completions somewhere that runs when you start a shell? maybe ~/.config/fish/config.fish?
- ilaksh 5y agoI have been using fish for years. I don't have those issues because I just leave the default as bash and run the fish command manually when I log in. Then if I have some incompatibility (pretty rare) I can just type 'exit'.
- faho 5y ago>And it does this every time you spawn a shell. It does not. The completion generation is on first start and whenever you run `fish_update_completions`. (note that the importance of man parsing is often quite overstated, it only gets you so far, all the advanced completion stuff is hand-written) Source: I'm a fish dev.
- pxc 5y agoOn NixOS, we generate the completions on behalf of users at install time, so they never have to see a slow startup at all. Fish makes it easy to do! Thanks :D
- pxc 5y ago> So if you have set your login shell to fish, then every time you launch a shell it loads all the fish plugins like this one, and that slows it down Fish completions and functions are lazy-loaded, so this doesn't happen unless you write your config to force it to happen. Fish also provides you with functions you can use to check whether a shell instance is a login shell, is interactive, or is just being invoked as (part of a) script. If you do have some heavy-duty stuff you want to run on startup for your login shell or your interactive shells, you can do that selectively and keep Fish startup for other purposes fast.
- thrwyoilarticle 5y agoShells and scripting languages are different things. I don't care how good of a scripting language Powershell is, it's painful to use as a shell. I don't care that fish can't run sh scripts, I've never used it on a machine that didn't have sh. Can we stop judging oranges for their lack of crunch?
- smoldesu 5y agoYeah, I hear a lot of people throw shade at fish and then act equally surprised when I don't run my scripts with it. Much like Bash, Perl, Python or even ZSH by some respects, fish is just another tool in my toolbox. It so happens to be the one I default to though, which for some reason sends people flying off the handle.
- pxc 5y agoIdeally you do want them to be the same, so that the skill of using one reinforces the skill of using the other, and you can begin to shape scripts out of your shell history. Output redirection doesn't work right with Fish functions, which makes them unusable in certain kinds of scripts. Aside from that, though, Fish is perfectly pleasant for simple scripting. I use Fish for simple stuff and PowerShell for anything serious. Some day I'd like to use something like Elvish or Nushell for both, and use the same language as my interactive shell.
- buu700 5y agoAgreed. I liked fish last time I tried it (probably over a decade ago), but bash scripting is what I'm familiar with and it's just so convenient in day-to-day usage to be able to throw out one-liners for mundane things and then have them permanently searchable in my history.
- yourad_io 5y agoI thought Ctrl+R was cool but in fish you are always in search mode! Start typing any part of your previous command and hit up arrow!
- 5y ago
- dang 5y agoOk, let's do this. Past related threads: Fish shell - https://news.ycombinator.com/item?id=27180420 https://news.ycombinator.com/item?id=27180420 - May 2021 (118 comments) Fish Shell 3.2 - https://news.ycombinator.com/item?id=26302678 https://news.ycombinator.com/item?id=26302678 - March 2021 (128 comments) Fish is not operational on a VT220 terminal (2015) - https://news.ycombinator.com/item?id=25526237 https://news.ycombinator.com/item?id=25526237 - Dec 2020 (113 comments) New Features in the Fish Shell - https://news.ycombinator.com/item?id=24631138 https://news.ycombinator.com/item?id=24631138 - Sept 2020 (138 comments) Dolphins learn from their peers to use empty shells to catch fish - https://news.ycombinator.com/item?id=23660910 https://news.ycombinator.com/item?id=23660910 - June 2020 (8 comments) (<-- just kidding) Fish: A command line shell for the 90s - https://news.ycombinator.com/item?id=21361696 https://news.ycombinator.com/item?id=21361696 - Oct 2019 (83 comments) Fish shell 3.0 - https://news.ycombinator.com/item?id=18776765 https://news.ycombinator.com/item?id=18776765 - Dec 2018 (220 comments) Fish: A user-friendly command line shell for macOS, Linux, etc - https://news.ycombinator.com/item?id=15910897 https://news.ycombinator.com/item?id=15910897 - Dec 2017 (204 comments) Fish (Shell) for a Week - https://news.ycombinator.com/item?id=14422672 https://news.ycombinator.com/item?id=14422672 - May 2017 (2 comments) The fish shell is awesome - https://news.ycombinator.com/item?id=14179081 https://news.ycombinator.com/item?id=14179081 - April 2017 (7 comments) Fish Shell Design Principles - https://news.ycombinator.com/item?id=11102941 https://news.ycombinator.com/item?id=11102941 - Feb 2016 (71 comments) Fish shell 2.2 - https://news.ycombinator.com/item?id=9873090 https://news.ycombinator.com/item?id=9873090 - July 2015 (70 comments) Fish shell - https://news.ycombinator.com/item?id=9566441 https://news.ycombinator.com/item?id=9566441 - May 2015 (182 comments) FISH Shell: A dynamic shell - https://news.ycombinator.com/item?id=8783150 https://news.ycombinator.com/item?id=8783150 - Dec 2014 (3 comments) Fish shell 2.1 - https://news.ycombinator.com/item?id=6626635 https://news.ycombinator.com/item?id=6626635 - Oct 2013 (151 comments) fish shell - https://news.ycombinator.com/item?id=6224524 https://news.ycombinator.com/item?id=6224524 - Aug 2013 (75 comments) Fish shell 2.0 - https://news.ycombinator.com/item?id=5723235 https://news.ycombinator.com/item?id=5723235 - May 2013 (175 comments) Fish 2.0 shell beta - https://news.ycombinator.com/item?id=5567639 https://news.ycombinator.com/item?id=5567639 - April 2013 (56 comments) Fish: Finally, a command line shell for the 90s - https://news.ycombinator.com/item?id=4073162 https://news.ycombinator.com/item?id=4073162 - June 2012 (146 comments) Fish sucks (but your shell sucks more) - https://news.ycombinator.com/item?id=2031110 https://news.ycombinator.com/item?id=2031110 - Dec 2010 (60 comments) Fish - The friendly interactive shell - https://news.ycombinator.com/item?id=820677 https://news.ycombinator.com/item?id=820677 - Sept 2009 (16 comments) Fish Shell: A User-Friendly Shell or Like a Heavily Customized zsh - https://news.ycombinator.com/item?id=811113 https://news.ycombinator.com/item?id=811113 - Sept 2009 (8 comments)
- desireco42 5y agoIt is typical HN that everyone is talking about Zsh and how it isn't so bad. And you know what, I used it for a while long time ago, and it is great. I even had config I could transport to another machine when I need. All that can't be compared with fish out of the box, which is why I am using fish, it will be 10 or so years now. When I say use, I mean that, I just use it, I don't spend time learning it's obscure features, creating scripts etc, no, just use it. I have alias list that I use to make myself productive and it goes along with me to a new machine. Very slim and simple configuration. That and Vim, but that is another story.
- vorticalbox 5y agowhere does one put an alias ? i have a collection of them in my .zshrc that i would love to use.
- iamevn 5y agothey're just functions so they end up in files in ~/.config/fish/functions/ $ alias foo bar $ function foo --wraps bar --description 'alias foo=bar' bar $argv end these two are basically equivalent. you'll need to $ funcsave foo to make it persist. this will write foo.fish into that functions folder. there's also abbreviations like $ abbr --add ll ls -lh which expand as you type. ll won't end up in your history because it's expanded before that.
- tryptophan 5y agoAbbreviations are actually brilliant! So much better than aliases. Long live fish.
- yourad_io 5y agoOne of my favorite features. I counted then recently - over 100. The killer feature over aliases is that a) you can edit them and b) you can define them instantaneously. Did you type `git diff --cached` one time to many? Up arrow -> Ctrl+a -> "abbr gdc " <enter> Bam. `gdc<space|enter>` now expands to that. It's there forever. And that's how you end up with 100+ abbreviations.
- err4nt 5y agoI've been happy with Fish shell for years! Yes, I could fiddle and twiddle with settings and configure a nicer shell, but Fish on its default settings on any OS just makes things smooth and easy!
- craigkerstiens 5y agoStrongly agreed here, it really just works. Sure you can get the same with zsh but the hours of my life I've spent tweaking and tuning zsh I'd happily give back because fish is good enough. When we built our CLI for Crunchy Bridge it was a couple lines to add tab completion to the CLI when running in Fish (https://blog.crunchydata.com/blog/introducing-the-crunchy-bridge-cli https://blog.crunchydata.com/blog/introducing-the-crunchy-br...), love that when building such tooling giving a better end user experience was so simple.
- peterhil 5y agoHave you tried Oil Shell? http://www.oilshell.org/ http://www.oilshell.org/
- sigmonsays 5y agoI've got way too many years of bash under my belt to invest in another shell. I gave oil shell a solid look and decided to not use it. While that may sound wrong, I dont see oil shell having enough features that are different enough to sway people over. I can't think of the saying here, but essentially its not disruptive in the shell space. Also, it's just shell. By the time I end up with a complicated shell script, i've rewritten it in go, python, etc. This is just my two cents, if I see more people talking about and using oil shell, I may reconsider.
- opk 5y agoI've not tried for a while but just getting that to even compile was a nightmare. It seemed to be a fork of the Python 2 code base. They've done the right thing by having a POSIX compatible layer but I completely disagree with their idea of what is wrong with the existing Bourne syntax and needs changing. An interactive shell needs to keep special characters to a minimum and stick to commands as the basic unit on which things are built. Zsh is already able to correct many of the worst elements of the Bourne syntax.
- jeppesen-io 5y agoI wish I could use fish, but I can't leave the fancy auto complete of kubectl and git
- EdwardDiego 5y agoFish does git autocomplete out of the box, and there's a Fisher plugin for kubectl autocomplete. Works great.
- beermonster 5y agoIs there anyone who can provide a simple summary for bash v zsh vs fish? Maybe I’m lazy but I’ve just stuck with bash for.. well since ever. Maybe it’s time to try something new but then if it ain’t broke… anyway would be interested in what things it does that I never knew I needed or things which just make life simpler/easier.
- bobbylarrybobby 5y agohttps://fishshell.com/docs/current/fish_for_bash_users.html#fish-for-bash-users https://fishshell.com/docs/current/fish_for_bash_users.html#...
- emilecantin 5y agoAutocomplete is much better. For example, just typing "y" displays "arn start" in gray _after_ my cursor. I can then refine my command, or use right-arrow to accept the suggestion. And this is just one example; fish is full of small usability touches like that. If you need to run a bash script, `bash the_script.sh` still works
- mikojan 5y agoOf course you could always just do ctrl+r and cycle through and refine suggestions in bash
- pxc 5y agoThe 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.
- yourad_io 5y agoExpanding 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)
- jrm4 5y agoSpecific 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?
- yourad_io 5y agoYou mean not splitting on spaces? No, never, ever bit me.
- faho 5y agoSpeaking with my fish developer hat on: The only common case where we find that splitting on spaces is actually needed is pkg-config and related tools, because that prints flags to be passed to the compiler, and it does it with spaces so it looks nicer and copy-pasteable: $ pkg-config --libs gio-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 (ideally, it would simply use newlines here, which bash et al would also split on) Typically, the easy workaround is `string split " "`: > somecommand (pkg-config --libs gio-2.0 | string split " ") Otherwise, this is quite rare in practice. Most unix tools already operate on a line-by-line basis, which allows them to be easily greppable.
- donio 5y agozsh has a short form for for loops too: for i in *.pdf; echo $i Shorter than the fish version. Does that mean that it's a better shell then?
- als0 5y ago> when you type something invalid it’s red, blue when not Does anyone know how to do something like this with Bash?
- Ultimatt 5y agoIs no one going to comment on for *.pdf assumes no spaces in filenames for the BASH example to be correct, what about Fish?
- moonchild 5y agoI do not know about fish, but it behaves correctly in zsh.
- pxc 5y agoFish doesn't do automatic word splitting on variable substitutions like bash does. Like ZSH (afaik), Fish doesn't require you to religiously surround every variable substitution in double quotation marks in case the contents have a space.
- gnubison 5y agoGlobs work correctly in Bash (not “BASH”), even with spaces in filenames. Yes, you need to quote most variable substitutions[0], but globs are fine. [0]: except in the RHS of a variable assignment or after the ‘case’ keyword
- oakmad 5y agoAnyone else read that as “The fish smell is amazing”?
- zepearl 5y agoI 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 :))
- aquajet 5y agoIs 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.
- akho 5y agoThe 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.
- yourad_io 5y ago> 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 < read`, etc. 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<CR>` (which, I did not, unless I had to write a portable script and needed a repl)
- vasergen 5y agoI 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.
- Hamuko 5y agoJust add #!/usr/bin/env bash?
- j4hdufd8 5y agoAgreed. Wish there was a pretty shell like fish that used /bin/sh under the hood.
- jaredklewis 5y agoMaybe it’s a personal quirk but all of my shell scripts have a shebang (#!) header anyway. I’ve used fish as my shell for years and still have so far never written any shell scripts in fish. It may also be a nice scripting language, but I personally use it because it’s a fantastic interactive shell.
- tomxor 5y agoMine even have a #!/usr/bin/env which I never shook due to going back and forth between Linux and FreeBSD at one point (bash isn't where you might expect). I think i'd be up for trying out a new shell for my command line, it's rare I use shell specific syntax heavily for one liners... unless I just don't know it yet.
- canjobear 5y agoJust invoke your scripts with sh or bash
- stevage 5y agoI 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
- jzer0cool 5y agoCould someone explain more the video demo? It ran the python interpreter which disappeared, but I didn't quite catch the meaning of this.
- aembleton 5y agoIt demonstrates the colour coding that fish gives to indicate if the command is valid (blue) or invalid (red). The video starts off with some other shell that doesn't do this and then runs the same commands again in fish.
- pmarreck 5y agoI'd rather have a more powerful shell that uses a functional style yet preserves many shell semantics we're all familiar with (like XS, https://github.com/TieDyedDevil/XS https://github.com/TieDyedDevil/XS , except maintained!) than an easier-to-use shell
- dirkg 5y agoI've gone down the rabbit hole with zshrc/bashrc customization, there are endless options and gists and pages and its a never ending rabbit hole. In the end I realized a well configured toolkit is enough for 99.99% of people, and there are an endless number of those as well. I use zsh-quickstart-kit which is updated often and has good speed and amazing features. You get all the fish features AFAIK and more with no risk of scripts breaking and it was a 1min install. For non devs who don't need to script I'd recommend fish and there are distros that default to it now.
- vermaden 5y agoIf you would like to add all these FISH things to ZSH: - highlighting and displaying last suggested command execution from history - file/dir highlighting - commands coloring and stuff Then check 'UPDATE 1' from here: https://vermaden.wordpress.com/2021/09/19/ghost-in-the-shell-part-7-zsh-setup/ https://vermaden.wordpress.com/2021/09/19/ghost-in-the-shell... I can not use FISH as it does not honor the POSIX syntax for loops and stuff and I often type 'for' and 'while' POSIX loops at command line so I use ZSH. Besides that FISH is really nice shell. Regards.
- DavideNL 5y agoCan anyone recommend a "sane zsh defaults" config that I can download and just works with approximately the same features as fish? (Without having to first learn/spend time about howto setup and configure plugins etc.)
- kall 5y agoI love fish. On any host, if I can just get fish running, I feel 100% at home. I don‘t need a single bit of customization on it.
- lolski 5y agoI've been a Fish user for 10 years! One key thing I like from Fish is their command history feature, where you can use the up/down to move backward/forward the history. I can't find a way to get this to work in ZSH I don't like having to CTRL+R for going backward (how do you even go forward, I can't remember :D)
- ZeroGravitas 5y agoI use and like fish, they mention the default color scheme, I keep meaning to change the unrecognised color from red to yellow. My general theory is that things with typos in them should be easier to read, than things recognized as syntactically correct, as you need to actually read the typo text to figure out what you've done wrong.