3 ms·
/bin/sh is mandated by posix, so there’ll be a link to usr. /bin/bash will be as well because /bin itself is a symlink to /usr/bin. Though that’s a very dumb
by masklinn 3y ago
/bin/sh is mandated by posix, so there’ll be a link to usr.
/bin/bash will be as well because /bin itself is a symlink to /usr/bin.
Though that’s a very dumb shebang to use and you should be ashamed: lots of systems don’t have it, or have an absolutely ancient system bash. By hard coding this you’re just making your scripts worse.
- VWWHFSfQ 3y agonah I always use /bin/bash because I use bash features and I don't want to use some crappy dash or fish or whatever default shell is set on the system
- masklinn 3y agoThat you’re using bash is an other problem which you also have. But the issue I’m talking about is using the specific path /bin/bash, as that just reduces compatibility compared to going through env.
- VWWHFSfQ 3y agono I like bash and all the systems I care about have /bin/bash so I don't care the /usr/bin/env bash thing always just seemed like pointless cargo culting to me. never had this problem
- doubled112 3y agoI think it is fair not to care if it isn't making a difference for you. “/usr/bin/env bash” will keep the shebang working between a Linux and FreeBSD (and probably other *NIX) machines. This bit me at one point, and it just became a habit since. Bash (if installed) is in /usr/local/bin there. Other interpreters often are too.
- _piif 3y agoAlso /usr/bin/env bash is required on NixOS and Guix, neither of which have /bin/bash.
- charcircuit 3y ago/usr/bin/env does not exist on Android. shebangs are inherently not portable because they can't be used to find a binary using $PATH.
- MrStonedOne 3y ago[dead]
- solarkraft 3y agoMan, I've tried to write POSIX-compatible scripts for a long time - twice as long as I'd probably have taken using bash features (using Python I'd probably have taken 1/10th of the time and it'd be way more maintainable now).
- kevin_thibedeau 3y agoThis is being done in the name of Solaris compatibility (why?) so you don't even get to use POSIX shell since it isn't in /bin/sh on that OS.
- pepa65 3y agoPython is in no way better maintainable than bash. If you'd used Python, most of your scripts would be broken right now. With bash, that just doesn't happen (to that extent).
- charcircuit 3y ago>/bin/sh is mandated by posix Where? POSIX says: Applications should note that the standard PATH to the shell cannot be assumed to be either /bin/sh or /usr/bin/sh, and should be determined by interrogation of the PATH returned by getconf PATH, ensuring that the returned pathname is an absolute pathname and not a shell built-in.