40m QIL Cryo_Lab CTN SUS_Lab TCS_Lab OMC_Lab CRIME_Lab FEA ENG_Labs OptContFac Mariner WBEEShop
  40m Log  Not logged in ELOG logo
Entry  Wed Jun 18 18:00:36 2014, ericq, Update, Computer Scripts / Programs, control room bashrc change 
    Reply  Thu Jun 19 14:52:20 2014, not ericq, Update, Computer Scripts / Programs, control room bashrc change 
Message ID: 10073     Entry time: Thu Jun 19 14:52:20 2014     In reply to: 10061
Author: not ericq 
Type: Update 
Category: Computer Scripts / Programs 
Subject: control room bashrc change 

Quote:

Some time ago, Rana changed the PS1 prompt codes on the control room computers. However, the exit codes of commands weren't being displayed, and there was some lingering color changing after the line. Hence, I changed it to look like this:

PS1='\[\033[0;35m\]\u'
PS1="$PS1\[\033[0;30m\]@"
PS1="$PS1\[\033[0;33m\]\h"
PS1="$PS1\[\033[0;97m\]|"
PS1="$PS1\[\033[0;92m\]\W"                                                 
PS1="$PS1\[\033[0;31m\] \${?##0}"
PS1="$PS1\[\033[0;97m\]>\[\033[0m\] "

The \${?##0} means: display the exit code if it is not zero (which means success). Thus, it only displays the exit code when its something other than what is expected.

  It's a very good plan to always inspect the exit code of your command.  Well done.

ELOG V3.1.3-