Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. is_solaris()
  2. {
  3. uname -a | grep SunOS >/dev/null
  4. }
  5. export -f is_solaris
  6.  
  7. ps1() {
  8. local l_ps1='';
  9.  
  10. local ID_PRG=id
  11. is_solaris && ID_PRG=/usr/xpg4/bin/id
  12.  
  13. hname=$(hostname -s)
  14. l_ps1="[$($ID_PRG -u -n)@$hname "
  15. current_directory=$(basename "$PWD")
  16. l_ps1="${l_ps1}${current_directory}"
  17. git status 2>/dev/null 1>/dev/null && \
  18. branch=$(git status | grep "On branch" | sed -e 's/On branch \([a-zA-Z0-9]*\)/\1/g') && \
  19. l_ps1="$l_ps1 (${branch})"
  20. l_ps1="$l_ps1]$ "
  21. echo $l_ps1
  22. }
  23. export -f ps1
  24.  
  25. export PAGER=less
  26. export EDITOR=vim
  27. export PS1='$(ps1) '
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement