7 ms·
If you're running scripts, what difference does it make that you use fish? You're not really supposed to write scripts for fish, unless it is meant to be used b
by okamiueru 5y ago
If you're running scripts, what difference does it make that you use fish? You're not really supposed to write scripts for fish, unless it is meant to be used be the fish shell itself. A shebang on the top of your script will invoke the script with the right executable, and whether you called it from bash, zsh or fish would make no difference.
- toxik 5y agoSo, instead of just typing shell commands, you type something else, but as soon as you need a shell script, you have to go back to shell commands.... Why not just cut out the middleman?
- okamiueru 5y agoAnswer to the first question: yes. Answer to the second question: because bash is a rather poor terminal shell. In my experience, the middleman you mention doesn't exist. Or, if anything, it is a very tiny man that hardly gets in the way. It's either a one-liner with a syntax change you can pick up in 5 minutes, or it falls under any combination of these: - might as well belong in a script - the complicated stuff is in awk or the likes - you can just enter bash for any copy-pasted bashisms - you can execute it explicitly with bash -c In any case, none enough of a hassle that it could demerit the immense productivity benefit I've gotten from fish. The only regret I have on that matter is not having ditched it sooner. Use bash to run scripts, or even better, sh. Use a different shell to make your life on the terminal better. Doesn't need to be fish, zsh is pretty good too. If I can offer any advice: if you still want to stick with bash, at the very least take a look at fzf, https://github.com/junegunn/fzf https://github.com/junegunn/fzf , aside from fish/zsh it's the best and most lowest hanging fruit.
- toxik 5y agoI personally use zsh, bash is too primitive with regards to its user interface (line editing, searching, vi keys, etc.) The syntax however is my key point here, I often take my commands and smack them into Makefiles for example.
- maccard 5y ago> You're not really supposed to write scripts for fish Given that 95% of my time in a shell is running a script, a shell that doesn't do that well isn't a great fit for me. > A shebang on the top of your script will invoke the script with the right executable, Assuming the person who wrote it had the foresight to do so. That person isn't always me, and if I have to manually check if each script I run has a shebang, I should just default to running them in bash.
- hibbelig 5y agoI haven’t seen a shell script in ages that was missing the shebang. Is this common in some places? I’ve started to write dash scripts because that seems to be reasonably posix and bash on macOS is ancient.
- IggleSniggle 5y agoI don’t think I’ve ever seen a script written without the shebang. Btw, you can get around the ancient bash in macOS by installing a more modern bash and invoking with /usr/bin/env bash as your shebang. Not sure if that’s a great idea, mind you, but if you’re already writing scripts in something non-portable, it’s an option.
- traviscj 5y agoYeah thing $T _might_ (but probably won’t) happen, so the idea is automatically terrible.
- maccard 5y agoThere are hundreds of sh files on github that don't have a shebang. Just because you don't write them and your colleagues don't doesn't mean they don't exist in the wild.
- IggleSniggle 5y agoI didn’t mean to imply that they didn’t exist nor that it might not be important to account for them in some contexts. I meant only to convey my own personal experience: that it had never occurred to me that I might need to account for a missing shebang, since providing an interpreter for a script via shebang is all I have ever personally encountered.