tags:

views:

86

answers:

6

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.

A: 

maybe

 abort //does not return

or possibly

test true //returns 0
test false // returns 1
test       // returns 1
Orbit
+2  A: 

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"

Tom Smilack
I know, but there would be an argument. So it would turn into `cat /dev/null executable.sh` which would just reveal all my source code.
cjavapro
What are you trying to do with the argument? Are you passing the nothing to it? The pipe | character redirects output.
Tom Smilack
A: 

Why not make your own in the same directory?

Oliver
+6  A: 

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'').
David Dorward
Perfect, thanks! (I used `/usr/bin/true`)
cjavapro
It's usually `/bin/true` on modern systems. On which OS is it `/usr/bin/true`?
Roman Cheplyaka
It is on Solaris 10.
cjavapro
A: 

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.
glenn jackman
A: 

try empty backquotes

``

echo $?

gives 0 for this.

abc