Re:Understanding the bin, sbin, usr/bin, usr/sbin split (2010)
by naniwaduni on Wednesday March 18, 2020 @03:12PM
(#22620173)
If you're writing a script that needs to be that portable, you're doomed anyway and you might even find the autoconf manual's "Limitations of Shell Builtins" section useful.
Re:Understanding the bin, sbin, usr/bin, usr/sbin split (2010)
by oat_bravo_nap on Wednesday March 18, 2020 @04:21PM
(#22620840)
If you are using /bin/sh you need to check sure it is a POSIX shell script and not using bash features [1]. On Debian and derivatives /bin/sh is ash not bash.
If I am writing a script that needs to be that portable, then I'll use #!/usr/bin/env sh but otherwise /bin/sh will work in all the cases I need it to.
Since bash's path might vary more, I might consider calling env to locate it then more often.