Pure POSIX shell scripting...

Hi all...

This is more of a concensus question than help...

As many of you know I am experimenting with the limitations of Pure POSIX shell scripting.

Q: Is the directory /bin considered part of the Pure POSIX shell or must I stick entirely with the builtins only?

The reason is I would really like to use cat for binary transfer but this is not a builtin but in the '/bin' directory.
The command dd would be useful too.

Comments?

There is no requirement in the standards saying that utilities found in /bin conform to the standard. The only files that the POSIX standards require to be at a specific location are / , /dev , /dev/console , /dev/null , /dev/tty , and /tmp .

The 2nd example in the EXAMPLES section on the POSIX command utility man page shows you how to start a POSIX script that will use the "standard" utilities when referenced by name assuming that you are running a POSIX conforming shell. And, if you can find a POSIX conforming command utility (note that command is almost always a shell built-in in a standards conforming shell, but there must also be a standalone command utility) the command:

command -pv standard_utility_name

will give you the pathname on your system of a POSIX conforming version of the utility named standard_utility_name in any shell.

2 Likes

Thank you Don...

As ever your knowledge of the shell is beyond reproach.
Will read the man page later today...