Advertisement
Guest User

bash prompt with color return code feedback

a guest
Oct 20th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Set the prompt (Fixed to do home directory properly)
  2. # Changes color if your last command failed to run successfully, but it also shortens long paths and contains the bash history number of each command for easy retrieval.
  3.  
  4. PS1="\[\033[0;33m\][\!]\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u.\h: \w]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement