[Gllug] show non-zero exit code in bash

Dean Wilson dwilson at unixdaemon.net
Tue Dec 27 11:59:08 UTC 2005


On Mon, Dec 26, 2005 at 11:08:20PM +0000, Greater London Linux User Group wrote:
> I don't think you'll achieve this by setting anything to do with the
> prompt. $? stays untouched until another command is executed, ignoring,
> quite rightly IMO, commands run by bash itself.

After playing with it some more I've come to agree.

> What you essentially want to do is follow each command with:
>      || echo "Oops! Buggered by a '$?'."

Except if the command already has a && or a || then there's a good chance
it'll screw up.

> (Of course you could make it more elegant by creating an alias, say 'e',
> so you could simply say '||e')

You're not lazy enough :)

> You could always hack the bash source to add this functionality if it's
> not already there :)

Um. Well. Er. I don't want it that badly ;)

  Dean
-- 
Dean Wilson		http://www.unixdaemon.net
Profanity is the one language all programmers understand
  --- Anon
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list