On 11/17/24 6:25 PM, Robert Elz wrote:
The use for testing for errors is also occasionally useful - a redirection
error will cause the shell to exit (non-interactive shell) so <file can
be a kind of shortcut for
test -r file || { printf >&2 message; exit 2; }
(or similar) (and output directions test that the file either exists or
can be created, and is writeable).
No, it usually doesn't. If a redirection error occurs with a special
builtin, POSIX says a non-interactive shell should exit. However,
just running
< file
where file doesn't exist or isn't readable, won't cause a non-interactive
shell to exit.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
