To sunstantiate this error, here are the relevant POSXI/Susv excerpts.
The shell scripts are executed in context of <file>. The POSIX standard
reads that the context is to be readabale in order to run the
instructions.
(1)
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
2. Shell Command Language
This chapter contains the definition of the Shell Command Language.
>> 1. The shell reads its input from a file (see sh), from the -c
option or from the system() and popen() functions defined in the
System Interfaces volume of IEEE Std 1003.1-2001. If the first line
>> of a file of shell commands starts with the characters "#!", the
results are unspecified.
(2)
http://www.opengroup.org/onlinepubs/009695399/utilities/sh.html
NAME
sh - shell, the standard command language interpreter
SYNOPSIS
sh [-abCefhimnuvx][-o option][+abCefhimnuvx][+o option]
>> [command_file [argument...]]
DESCRIPTION
The sh utility is a command language interpreter that shall execute
commands read from a command line string, the standard input, or a
>> specified file. The application shall ensure that the commands to be
executed are expressed in the language described in Shell Command
Language.
(3)
Based on these points it can be concluded that it's an error by
definition to not be able to "read a file" given as an ARG for a shell
to execute. Compare to situation
type sh
/bin/dash
touch file
chmod 000 file
sh file
echo $?
127
So this context, should behave similarly:
rm file
mkdir file
sh file
=> should print an error
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]