bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sharing My Prompt


From: Roger
Subject: Sharing My Prompt
Date: Sun, 28 Aug 2011 22:01:08 -0800
User-agent: Mutt/1.5.21 (2010-09-15)

Just wanted to share my current prompt after a month or so polishing.

Seems to be pretty darn good and figure I'll probably use this one for a good
long time.  (Yea right. ;-)

PROMPT_COMMAND='RET=$?; if [[ $RET -eq 0 ]]; then echo -ne 
"\n\033[0;32m$RET\033[0m ;-)"; else echo -ne "\033[0;31m$RET\033[0m :-(\n"; fi; 
echo -ne "\n"'
PS1='\[\033[01;address@hidden;34m\] \w \$\[\033[00m\] '


Gives the following return value (w/ smiley) separated by a few blank lines.
(Ref. ArchLinux Wiki, but mine is better by adding a few additional newlines!)

address@hidden ~ $ echo


0 ;-)
address@hidden ~ $ echl
bash: echl: command not found

127 :-(
address@hidden ~ $ 



I've also just incorporated the following PS4 value for shopt xtrace:
PS4="$0 line ${LINENO}: "

Output modifies xtrace stdout adding script name & line numbers.  Wow, much
more informative then the default xtrace stdout! (Ref. Oreilly's
Learning_the_bash_Shell_Third_Edition)

-- 
Roger
http://rogerx.freeshell.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]