6 ms·
To preface — I love Fish — "Finally, a command line shell for the 90s" is an apt description. I use it every day. But I haven't managed to recommend it to begi
by maximilianroos 6y ago
To preface — I love Fish — "Finally, a command line shell for the 90s" is an apt description. I use it every day.
But I haven't managed to recommend it to beginners. There are so many bash instructions out there, and translating between bash and fish isn't easy for a beginner.
That's a great shame and missed opportunity, because beginners would in particular value a nice shell. The shell is often one of the harder tools to learn — e.g. I find beginners are more comfortable in a Jupyter Notebook than they are the shell.
I'm not sure whether there's a way of combining fish's ease of use with a notion of compatibility — maybe a "bash mode" for beginners, which accepts bash commands? Or error messages which return translated commands?
(I recognize not all commands can be translated, but all of those that would be run by a beginner can be)
- zamadatix 6y agoHave you seen https://www.oilshell.org/ https://www.oilshell.org/
- SAI_Peregrinus 6y agoOil is more focused on making shell scripting nicer, Fish is more focused on making shell interaction nicer. Both are cool projects, just slightly different focus.
- oblio 6y agoIf Oil makes error checking and error messages nicer, it will have provided an awesome service to the community.
- jiehong 6y agoUsually, those commands can be run in bash from fish with a bash -c, or from a file.
- SAI_Peregrinus 6y agoOr via Bass[1], for things that modify the environment. [1] https://github.com/edc/bass https://github.com/edc/bass
- pjmlp 6y agoActually it is more "Finally, a command line shell for the 80s". "Xerox Alto" https://www.computerhistory.org/revolution/input-output/14/347 https://www.computerhistory.org/revolution/input-output/14/3... Having grown through the UNIX adoption in the enterprise, it kind of feels ironic that nowadays bash is kind of seen as the UNIX shell, and in those days it was just one among many possibilities to configure on /etc/passwd
- snazz 6y agoBash is definitely seen as the "Linux shell", but most users of non-Linux Unixes and Unix-likes don't use Bash. macOS, for instance, now uses Zsh out of the box (although most Bash one-liners still run unmodified in Zsh). But Linux is the majority of the Unix-like market, so it (and therefore Bash) dominates.
- tssva 6y agomacOS just recently switched to zsh as the default and doesn't change the shell for existing users so I imagine it is likely the majority of macOS users are still using bash.
- snazz 6y agoTrue, although it gives you a pretty prominent notice that Zsh is now the preferred shell when you start Terminal for the first time after updating to Catalina.
- mixmastamyk 6y agoI think it's referencing the color support that didn't really hit until the 90s.
- binaryanomaly 6y agoJust enter "bash" when you need bash and exit it once you're done. Barely need this but sometimes it's useful. Fish imho offers superb usability, wouldn't want to miss it.
- lighthazard 6y agoYou lose all the fish goodies when you do this, no?
- Zardoz84 6y agoyou only need to paste a line or two of bash. it's what I did when I have a problem with some online help that put a line that only works on bash
- binaryanomaly 6y agoexactly.
- riyadparvez 6y agoSome commands are compatible with bash, but not compatible with zsh. I do the same thing when using zsh.
- hinkley 6y agoIt's a chronic problem on work projects that people write shell scripts without a shebang operator at the top. Obscure error messages are usually how I find out someone is using zsh, fish, or some other shell. I fix what I can, but it's like mopping up water during a rainstorm. Yes it's better than doing nothing, but also there will be more in twenty minutes so don't make any plans.
- azernik 6y agoOne way I force people (mostly myself) to include shebang lines: Have a scripts directory in my repo that mixes shell and python scripts with no file extensions and executable bits set. If I don't put a shebang, it just doesn't run. Of course, this requires you to have firm control of code style policies.
- maple3142 6y agoBut, does shebang works when you want to source some files?
- duckerude 6y ago> Or error messages which return translated commands? Fish does this in some cases: ~> echo $(true) fish: $(...) is not supported. In fish, please use '(true)'. echo $(true) ^ > (I recognize not all commands can be translated, but all of those that would be run by a beginner can be) Not all of them, unfortunately. Consider `while true; do something; done`. Fish interprets this as an unclosed while loop, where `do` and `done` are ordinary commands. So if you enter it you don't get a syntax error, fish just waits for more input until you enter `end`. The same goes for `if` and `for`.
- maximilianroos 6y agoGood point on the loop, I hadn't thought about that, thanks for correcting me. On the error messages, I was thinking even clearer for beginners, giving them the whole statement, to avoid uncertainties around where the quotes should be included in '(true)'. Maybe even a shortcut to paste the corrected line in their terminal. echo $(true) ^ fish: $(...) is not supported. In fish, please use '(true)', like: echo (true) Alt+r will insert this line in your terminal.
- alan_n 6y agoI wish someone had recommended fish to me as a beginner. When I discovered it I was finally able to write some aliases and scripts without copy/pasting, overdoing it by resorting to a real programming language, or wasting an entire day trying then giving up. Concerning bash instructions, it's not that hard to translate them imo, or you can just use bass or just pop into bash for a second.
- ilaksh 6y agoIt actually doesn't come up that often. A lot of times you can just either A) paste one line at a time or B) use double quotes. But what I do is I run fish manually on top of bash. If I have an issue, I just type exit and then try to paste the commands in again. Then when I am done I restart fish.
- chubot 6y agoThis is the point of Oil -- having a smooth upgrade from bash. The interactive shell ended up being more work than I anticipated. So I'm looking for people who want to run with it either as a separate project or part of Oil. http://www.oilshell.org/blog/2020/02/recap.html#fish-oil-is-a-good-idea-link http://www.oilshell.org/blog/2020/02/recap.html#fish-oil-is-... Another option is to link Oil as a C++ library into another shell, which is starting to become possible. Oil handles all the difficult language and compatibility issues, and encapsulates them, so it's a great complement to someone who only wants to work on the interactive shell. Even though it cleans up many legacy warts, Oil runs thousands of lines of real bash programs: https://github.com/oilshell/oil/wiki/Shell-Programs-That-Run-Under-OSH https://github.com/oilshell/oil/wiki/Shell-Programs-That-Run... Posts on the interactive shell: https://www.oilshell.org/blog/tags.html?tag=interactive-shell#interactive-shell https://www.oilshell.org/blog/tags.html?tag=interactive-shel...
- Osiris 6y agoI found that adding the "&&" operator recently has fixed that for a lot of common cases. I still prefer the "; and" syntax though.
- markstos 6y agoExtra compatibility has been added lately, like && and ||. More bash syntax Just Works now. I think it's fair to say "If it doesn't work in fish, just type `bash` to enter a bash shell and try again."
- mxcrossb 6y agoI don’t think this is such a big deal. Every programmer needs to become sufficient in bash because odds are you’re going to log into another computer which only has bash or csh, and likely you need to modify someone’s bash script. It’s probably best for beginners to learn bash first, and for intermediate users to switch to fish once they understand the concepts.