I want to put it at the top of a unix executable.开发者_如何学编程 right after the #!
I know it seems silly, but I would like suggestions.
Most systems have a /usr/bin/false
NAME
false -- Return false value.
SYNOPSIS
false
DESCRIPTION
The false utility always exits with a nonzero exit code.
SEE ALSO
csh(1), sh(1), true(1)
STANDARDS
The false utility conforms to IEEE Std 1003.2-1992 (``POSIX.2'').
Sounds like a job for the "colon" built-in
: [arguments] No effect; the command does nothing beyond expanding arguments and performing any specified redirections. A zero exit code is returned.
You could try cat /dev/null
"[T]he null device is a special file that discards all data written to it . . . and provides no data to any process that reads from it"
Why not make your own in the same directory?
maybe
abort //does not return
or possibly
test true //returns 0
test false // returns 1
test // returns 1
try empty backquotes
``
echo $?
gives 0 for this.
精彩评论