An exit status of zero indicates success, and a nonzero value
indicates failure. GNU
sed returns the following exit status
Invalid command, invalid syntax, invalid regular expression or a
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,
sed aborted immediately.
Additionally, the commands
Q can be used to terminate
sed with a custom exit code value (this is a GNU
$ echo | sed 'Q42' ; echo $? 42