Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Fish is great. I used it for a couple of years, right up until I had to install a software system that made extensive use of bash scripts that were incompatible with it. At the time I was in too much of a hurry to figure out how to tell the software to explicitly use bash, or something along those lines.


As a rule of thumb you should make fish the default shell for your terminal emulator and leave bash as the login shell. This will let all the system configuration scripts work just fine.

The only time when POSIX incompatibility still hurts is if your workflow requires you to be source shell snippets.


Why would a software system that relies on bash not explicitly use bash for its scripts?


Bad developers. For example, I used Arch Linux for a number of years, where `/bin/sh` is a symlink to bash. Switching that to point to `dash` broke a number of programs both in the official repositories and the AUR. A lot of shell scripters can't spot a bashism, and just as many don't know that other shell syntax even exists.


That's a different problem, though. /bin/sh must point to a sh-compatible shell. fish is not a sh-compatible shell. Therefore, any script using /bin/sh will never attempt to run as fish (as /bin/sh will never point to fish).

The reason I'm having a hard time imagining how a scripting system that relies on bash would fail with fish is because I can't imagine how one would actually write a script that is executed with the user's login shell. There's no #! line that would do that by accident.


There's just one scenario: a completely absent #! line.

It's an easy fix, just add the line, otherwise 0755 scripts with no #! do execute using the current shell.


That doesn't work for me (in Fish).

  > cat foo
  echo wat
  > ./foo
  Failed to execute process './foo'. Reason:
  exec: Exec format error
  The file './foo' is marked as an executable but could not be run by the operating system.
It does however work in Bash. So this appears to be a bash-ism, rather than an OS feature.


Ah, bummer. I tested in csh too but not fish.


More likely, and somewhat less judgmentally, developers that are ignorant of the distinction.

Unless you want to define "bad" as "ignorant of some facet of computing" in which case we all fit.


I can't think of any other definition of "bad" when it comes to programming. But I do appreciate your sentiment and realize I was being unjustly negative.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: