return code fun!

Mark Sicignano mark at hsi86.hsi.com
Wed Feb 13 08:07:25 AEST 1991


Let me just show you...

$ false
$ echo $?
1

$ false ; echo $?
1

$ false | echo $?
0

Ok... so the $? must be from the previously executed command, which 
is the previous echo, which returned 0?

So, this should print 1?

$ false
$ false | echo $?
0

wrong...

What is this 0 return status coming from?  The pipe?  When a pipe
is created, does the shell set $? depending on whether or not the 
pipe was successful?

Don't tell me that "false | echo $?" has no useful purpose.  I know
that!!!!  I'm just trying to use it as a simple example!

-mark
-- 
Mark Sicignano                                  ...!uunet!hsi!mark
3M Health Information Systems                   mark at hsi.com



More information about the Comp.unix.questions mailing list