top | item 37273149

(no title)

laputan_machine | 2 years ago

Yes, 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

discuss

order

_TwoFinger|2 years ago

> I had to [...] and set my shell to bash/zsh

Most likely a command in your script (or one source-d into it) makes an assumption about your $SHELL or login shell that is true for bash/zsh but not for fish.

Merely adding a shebang won't fix such a script.

pxc|2 years ago

See my other comment and let me know if that script contains

  ssh-agent $SHELL ...
or

  exec $SHELL ...
or

  eval "$SHELL ..."
or similar. :)

If it ends up passing a script file or arguments to $SHELL and you wanna fix it without rewriting it, just add some conditionals where $SHELL is used and use the equivalent flags or syntax when $SHELL indicates fish.

Alternatively, if you just wanna work around it, just launch that script like

  env SHELL=(which zsh) whatever-script.sh

em-bee|2 years ago

fish 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.

pxc|2 years ago

Fish definitely has builtins, for example

  - cd
  - source, .
  - eval
  - string
  - and
  - or
  - builtin
  - command
and many others.

Not sure what the point of distinguishing between fish builtins and fish functions is; whether a builtin is shipped as a function distributed with fish or a reserved word in the fish evaluator seems like an implementation detail.