Shouting the return code. (Re: Meaning of "rc" in cron/log)

Lawrence V. Cipriani lvc at tut.cis.ohio-state.edu
Wed Jun 29 00:46:42 AEST 1988


In article <3671 at psuvax1.cs.psu.edu>, flee at gondor.cs.psu.edu (Felix Lee) writes:
> Does ksh let you put the return code in the prompt? Something like
> PS1='($?) '?
Yes, this PS1 displays the exit value of the "previous command".  $? will
change value on an interrupt however.

>  Showing only non-zero return codes would be better.
Why?  Knowing a command completed successfully might be useful if
stdout/stderr for the command were redirected.

> Return codes are interesting.  Really.  IBM's VM/CMS will tell you about
> non-zero return codes.  (The prompt is either 'R;' or 'R(nnn);')
Return codes are boring.  Really.

> Unix hides return codes well.
If you need them you can get them, if you don't want to see them you
don't have to.  I bet you don't have this flexibility in IBM's VM/CMS.

My feeling is the shorter my PS1 prompt the better.  There was a time
when my PS1 included my login id, the machine name I was logged in on,
the time of day (you can do this in ksh), and even some graphics
sequences.  After a few weeks I changed it all back to just the machine
name (since I will simultaneously be logged in several systems).

>Ever try unconfusing someone about why
> "true" is "exit 0", but "false" is "exit 1"?
Yeah, and read the man page for true/false to them, it always gets
funny looks, and usually some laughs after you explain it to them.
	...
> Felix Lee	flee at gondor.cs.psu.edu	*!psuvax1!gondor!flee
-- 
Larry Cipriani, AT&T Network Systems and Ohio State University
Domain: lvc at tut.cis.ohio-state.edu
Path: ...!cbosgd!osu-cis!tut.cis.ohio-state.edu!lvc (strange but true)



More information about the Comp.unix.questions mailing list