5 ms·
Tried fish a couple of times, it's really good, many zsh plugins are created to replicate features of fish. But it's not my default shell, because I need to ru
by girishso 3y ago
Tried fish a couple of times, it's really good, many zsh plugins are created to replicate features of fish. But it's not my default shell, because I need to run bash shell scripts and I didn't find any way to do it in fish. So I am stuck with my slow zsh.
- keepamovin 3y agoMaybe ask ChatGPT4 to translate them?
- notnmeyer 3y agothis shouldn’t be necessary and is probably fairly error prone. using one shell doesn’t mean you can run stuff in another. if someone is saying they can’t run a bash script when they’re invoking bash from fish the most likely thing is they’re doing something wrong.
- pxc 3y agoI asked an LLM to translate a bash script to fish once and it just changed the shebang line... cracked me up. Edited to add: There's a program out there for translating bash to fish called babelfish. It's pretty good but not complete, so it won't work for all scripts. Worth checking out, though: https://github.com/bouk/babelfish https://github.com/bouk/babelfish
- keepamovin 3y agoYeah, I've seen those stuck in loops where they don't see an obvious mistake.
- st3fan 3y agoYou don't have to translate them. Just stick `#!/usr/bin/env bash` on top. It is totally fine to use fish as your "terminal shell" and default to Bash for scripting for things like automation, etc. I've been doing this for a decade. I will also add that Fish is so good by default that I barely have any config.
- 28304283409234 3y agoI just run `bash script.sh`, or `./script.sh`? What does not work for you exactly?
- deleted 3y ago[deleted]
- bin_bash 3y agoI often see people complain about this but I seriously don't understand. The shebang at the top of a bash script will point to bash no matter what your shell is.
- laputan_machine 3y agoYeah I would have thought so too, but I have personally ran into this issue running fish-shell on my mac. There are some scripts I need to run that do not work even when I shebang the script to run in bash.
- stavros 3y agoThat's really odd. I have never had a single issue with this, I don't understand how shebanged scripts can fail? What's the error?
- laputan_machine 3y agoYes, it really is odd, I couldn't figure it out so switched back to zsh. The specific issue was to do with a script we had to run to gain ssh access to an internal network. I can't post the script, but it was related to openssh. Even logging into bash and running the script didn't work, I had to remove all fish binaries, symlinks, etc and set my shell to bash/zsh. Maybe it was an issue with how I installed fish, but yeah like I said, very strange, but I can vouch that I've encountered a similar issue before It's a real shame because I think the fish syntax alone is worth the switch, for my personal machine(s) I use it. Edit: this was years ago now, about 4 years, maybe the issue doesn't exist anymore but it caused me a bit of grief at the time (beacuse I didn't know it was related to using fish!), I've not since tried it again. I might try again and get back to this thread
- em-bee 3y agofish doesn't have builtins but all fish commands are external binaries or fish functions. i think at one point early in the history of fish those binaries may have been installed on the global path so they were accessible outside of fish and possibly there was a name conflict with one of them that this script triggered. although such a name conflict should not have happened (and i can't think of which command such a script might have used that would also be a fish command), and the global path thing was also fixed soonish. but this is all a faint memory, so i am not sure i remember any of that right.
- mroche 3y agoIs the issue running bash shell scripts or copy-pasting one liners? If the latter, you can always use the command flag for bash to execute one liners within its own context. bash -c "grep word file.txt | sort -u | tail" Scripts shouldn't be an issue as long as you either launch it with the proper shell or configure the shebang correctly after making the script executable.
- PufPufPuf 3y agoWhat do you mean? If the script is using hashbang, you can just run it. If not, run "bash script.sh". If you need to source it, use the plugin "bass". If you want to run a one-time bash command copypasted from somewhere, just type "bash", run your command, and then ctrl-c.