Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!purdue!mailrus!tut.cis.ohio-state.edu!lvc From: lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) Newsgroups: comp.unix.questions Subject: Re: Shouting the return code. (Re: Meaning of "rc" in cron/log) Summary: echo $? Message-ID: <16500@tut.cis.ohio-state.edu> Date: 28 Jun 88 14:46:42 GMT References: <717@mccc.UUCP> <16377@tut.cis.ohio-state.edu> <3671@psuvax1.cs.psu.edu> Distribution: na Organization: Ohio State Computer & Info Science Lines: 33 In article <3671@psuvax1.cs.psu.edu>, flee@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@gondor.cs.psu.edu *!psuvax1!gondor!flee -- Larry Cipriani, AT&T Network Systems and Ohio State University Domain: lvc@tut.cis.ohio-state.edu Path: ...!cbosgd!osu-cis!tut.cis.ohio-state.edu!lvc (strange but true)