SHARE
TWEET

Bash prompt with path shortening (v2)

a guest Mar 15th, 2017 358 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. PS1='$(if [[ $? != 0 ]]; then echo "\[\e[31m\]"; else echo "\[\e[2;37m\]"; fi)\!\[\e[0m\] $(if [[ $(id -u) == 0 ]]; then echo "\[\e[1;31m\]"; else echo "\[\e[1;32m\]"; fi)\u\[\e[1;32m\]@\H\[\e[0m\] $(_PWD=${PWD/"$HOME"/"~"}; if [[ ${#_PWD} -gt 30 ]]; then echo "${_PWD:0:14}..${_PWD:(-14)}"; else echo "${_PWD}"; fi) $([ \j -gt 0 ] && echo "\[\e[2;37m\][\j]\[\e[0m\] ")\$\[\e[0m\] '
RAW Paste Data
Top