I have read that POSIX compliant operating systems (for example: Linux) must have the sh
shell.
But is it required for sh
to be in the /bin
directory, or can it be in any directory?
linuxposixshell
I have read that POSIX compliant operating systems (for example: Linux) must have the sh
shell.
But is it required for sh
to be in the /bin
directory, or can it be in any directory?
Best Answer
POSIX only mandates the
/dev
and/tmp
directories to exist, and the/dev/null
,/dev/tty
, and/dev/console
files. The standard utilities must exist, but there is no particular location specified. There may not be a/bin
at all, and if there is it may not contain ash
, and if it does that may not be a POSIXsh
.You can get a valid
PATH
variable that includes the POSIX tools, includingsh
, with thegetconf
command:This can be useful on, for example, Solaris, where the default
sh
is not POSIX-compatible, but a compliantsh
is provided and accessible in that way (because Solaris is a certified Unix).getconf PATH
will include/usr/xpg4/bin
at the front, which contains POSIXsh
and a number of other required tools (including useless ones likecd
).