18 lines
888 B
Org Mode
18 lines
888 B
Org Mode
|
#+title: My BASH prompt
|
||
|
#&summary
|
||
|
What my prompt does and what it looks like.
|
||
|
#&
|
||
|
#+license: bysa
|
||
|
|
||
|
* My BASH prompt
|
||
|
|
||
|
I have my own bash prompt. To use it, first, copy this into your ~.bashrc~:
|
||
|
|
||
|
#+BEGIN_SRC sh
|
||
|
PROMPT_COMMAND="EXCO=$?;pwdw=$(($COLUMNS-20))"
|
||
|
PS1='\[\033[00m\]$(if [ $EXCO == 0 ]; then echo -ne "\[\033[42m\]\[\033[01;30m\]"; else echo -ne "\[\033[41m\]\[\033[01;34m\]"; fi)$(length-extra-prepend $EXCO 3)\[\033[45m\] \[\033[44m\]\[\033[01;37m\]$(date +%H:%M)\[\033[45m\] \[\033[46m\]\[\033[01;33m\]$(length-too-much-shorten "$(pwd | sed s%$HOME%~%)" $(if (( $pwdw < 20 )); then echo -n 20; else echo -n $pwdw; fi))\[\033[00m\]\n\[\033[45m\]\[\033[01;33m\]\u\[\033[01;32m\]@\[\033[01;36m\]\h\[\033[43m\]\[\033[01;30m\]:\[\033[40m\]\[\033[01;33m\]\$\[\033[00m\] '
|
||
|
#+END_SRC
|
||
|
|
||
|
Second, download [[bash-prompt-extras.tar.gz]] and put the included programs
|
||
|
somewhere in =$PATH=&sh.
|