6 ms·
+1 for fish, the autocompletion alone makes it my daily driver. You can get the same in any reputable shell, but I like that it is designed into it from the gro
by dj_mc_merlin 6y ago
+1 for fish, the autocompletion alone makes it my daily driver. You can get the same in any reputable shell, but I like that it is designed into it from the ground up (the zsh autocompletion plugin brands itself as "fish-like").
It's also compatible-enough with POSIX for most purposes, and supported as an alternative for lots of software (venv comes to mind).
- xthetrfd 6y agoOne area where fish is excellent is IMO interactive shell scripting. No more case..esac and friends. Fish adopts a python-like syntax that makes it ridiculously easy to write loops fast in the terminal.
- bool3max 6y agoIt's an absolute godsend. Scripting in it feels really intuitive compared to POSIX shells. I find it such a shame that we probably won't get rid of POSIX shells for at least a couple more decades... if that.
- O_H_E 6y agoWell, oilshell has been positioning itself as an upgrade path forward.
- beagle3 6y agoYou can have real Python scripting with xonsh. It combines Python ness and shellness very nicely. I agree that fish is a sweet middle ground spot.
- saurik 6y agoSo I read this and thought "wow, indentation would be so stupid to manage in a terminal... even typing python into python's repl is brutal" but then I looked up the syntax for a for loop in fish and it is exactly the same as the syntax in bash except it uses the word "end" instead of "done" and doesn't have "do"... what am I missing?
- nanna 6y agoOoh switching to Fish from Bash could be a nice weekend task. Any tips on common tripping points?
- Hamuko 6y agoYou might want bass (https://github.com/edc/bass https://github.com/edc/bass) or replay.fish (https://github.com/jorgebucaran/replay.fish https://github.com/jorgebucaran/replay.fish) if you need to run bash scripts that modify the shell. I personally use replay.fish (although I guess I haven't updated in a while since my version is still called "bax").
- gpanders 6y agoIf you want a plug-in free solution, you can try the following: $ exec bash -c ‘source script.sh; exec fish’ This has some caveats and won’t work in all cases (both bass and replay.fish go into more detail), but this is what I use and it hasn’t failed me yet.
- gpanders 6y agoDo it! You will never look back. The most common tripping points are the minor adjustments in syntax, probably the biggest one being command substitution: Bash: $ echo “$(ls -al)” Fish: $ echo (ls -al) You get used to it though. Another thing many bash-ers sometimes miss is the !! substitution, e.g. $ apt update # permission denied $ sudo !! This doesn’t work in fish, BUT fish does offer a handy keybinding out of the box to prepend ‘sudo’ to your current command line (submitted by yours truly). So when using fish, you’d handle the above scenario like this: $ apt update # permission denied # press Up or Ctrl-P followed by Alt-s $ sudo apt update There are so many other great things I love about fish, but this comment is already long enough. Be sure to read (or at least scan) through the user guide on their website. It’s an easy read and not dense. You can also view it at any time by running `help` from inside fish. I can’t recommend fish highly enough, I’m excited for your journey :)
- nanna 6y ago
- the_gipsy 6y agoBut why with arrow keys? I couldn't figure out how to remap to tab and gave up on fish.
- hibbelig 6y agoIn fish, tab does normal completion. Right-arrow accepts the current suggestion. You can use Ctrl-F instead of right-arrow (as usual for Emacs-inspired movement keys). Edited to add: A suggestion is a complete command line based on the history. Completion looks at the disk for file names and the like, and only talks about the current "word".
- cytzol 6y ago> Right-arrow accepts the current suggestion. If the '→' key is too far away from the home row for your liking, you can use Control-E instead, as long as you're at the end of the input buffer (it's the "go-to-end-of-buffer" command normally)
- the_gipsy 6y agoThank you. I will definitely try again!
- zests 6y agoHow often do you find yourself forced to use bash? ssh/machine init scripts/etc. I could never use an alternative shell full time because I need to stay good at bash.
- cytzol 6y agoI've been using fish at home and bash at work for almost a decade now, and it's been fine — and because I'm at a fish shell on my own computer far more often than I'm at a bash shell on a work server, I'm willing to take the slight productivity hit there, because I gain overall. The thing is, when I picked up fish, I couldn't forget my existing bash knowledge. I still have to write normal bash-dialect shell scripts, and with the fish syntax being so much nicer and simpler, the two can happily co-exist in my head. Occasionally I'll hit Up to search through history instead of Control-R, but I quickly realise what I've done and use the bash keybinding instead. And the only fish aliases I missed were 'l', 'll', and 'la', which I just manually copied over without bothering with the rest. If I had to use bash more often at work... I'd still use fish at home after all the time I've sunk into it, but YMMV.
- kbd 6y ago“I have to use the lowest-common-denominator thing everywhere because I have to use it somewhere“ is an argument that never made sense to me.
- ducktective 6y agoThat's pretty much my argument for choosing Bash over Python for my everyday scripts. It's sensible.
- marmaduke 6y agoSwitching between tools has a cost, so the tool needs to be not just better than another, but better after accounting for switch cost.
- zests 6y ago