Previous: Command-Line Options, Up: Invoking sed [Contents][Index]
An exit status of zero indicates success, and a nonzero value
indicates failure. GNU sed
returns the following exit status
error values:
Successful completion.
Invalid command, invalid syntax, invalid regular expression or a
GNU sed
extension command used with --posix.
One or more of the input file specified on the command line could not be opened (e.g. if a file is not found, or read permission is denied). Processing continued with other files.
An I/O error, or a serious processing error during runtime,
GNU sed
aborted immediately.
Additionally, the commands q
and Q
can be used to terminate
sed
with a custom exit code value (this is a GNU sed
extension):
$ echo | sed 'Q42' ; echo $? 42