3 ms·
> it says: Applications should note that the standard PATH to the shell cannot be assumed to be either /bin/sh or /usr/bin/sh It also recommends a script: "Ins
by jackewiehose 8y ago
> it says: Applications should note that the standard PATH to the shell cannot be assumed to be either /bin/sh or /usr/bin/sh
It also recommends a script: "Installation time script to install correct POSIX shell pathname".
But I wonder how they execute this script. So this is all crap. They should remove that and instead put in something like "you have to test your script on the platform where you deploy.".
The article is missing the one big problem I encountered at most: bin/sh instead of bin/bash or the wrong version of sh|bash.
- jwilk 8y ago> But I wonder how they execute this script. As I mentioned earlier, the trick is to have no shebang. If the first line of a file of shell commands starts with the characters "#!", the results are unspecified. [...] If the execve() function fails due to an error equivalent to the [ENOEXEC] error [...], the shell shall execute a command equivalent to having a shell invoked with the pathname resulting from the search as its first operand, with any remaining arguments passed to the new shell, except that the value of "$0" in the new shell may be set to the command name. Source: http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu...