Guest User

Untitled

a guest
Jul 17th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. # Terminal settings
  2. # Enable colors on the command-line for things like ls.
  3. export CLICOLOR=1
  4. export LSCOLORS=dxfxcxexbxegedabagacad
  5.  
  6. # Set the shell format to:
  7. # [host:user] [date] /path/to/pwd (size of files in dir)
  8. # $ <input>
  9. RED=$(tput setaf 1)
  10. GREEN=$(tput setaf 2)
  11. YELLOW=$(tput setaf 3)
  12. BLUE=$(tput setaf 4)
  13. NORM=$(tput sgr0)
  14.  
  15. ENCLOSURE_COLOR=$YELLOW
  16. PATH_COLOR=$RED
  17. HOSTNAME_COLOR=$GREEN
  18. USER_COLOR=$GREEN
  19. TIMESTAMP_COLOR=$GREEN
  20. FILESIZE_COLOR=$GREEN
  21. COLON_COLOR=$YELLOW
  22. BRANCH_COLOR=$GREEN
  23.  
  24. size_of_files_in_directory() {
  25. TBytes=`ls -l | awk 'BEGIN {sum=0} /^-/ {sum+=$5} END {print sum}'`
  26. TotalMeg=$(echo -e "scale=3 \n$TBytes/1048576 \nquit" | bc)
  27. echo -n "$TotalMeg"
  28. }
  29.  
  30. parse_git_branch() {
  31. branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/"`
  32. if [ -n "$branch" ]
  33. then
  34. echo -n " $ENCLOSURE_COLOR($BRANCH_COLOR$branch$ENCLOSURE_COLOR)$NORM"
  35. fi
  36. }
  37.  
  38. PS1="\n$ENCLOSURE_COLOR[$HOSTNAME_COLOR\h$COLON_COLOR:$USER_COLOR\u$ENCLOSURE_COLOR] [$TIMESTAMP_COLOR\$(date +%m-%d\" \"%H:%M)$ENCLOSURE_COLOR] $PATH_COLOR\w $ENCLOSURE_COLOR($FILESIZE_COLOR\$(size_of_files_in_directory) Mb$ENCLOSURE_COLOR)$NORM\$(parse_git_branch)\n\$ "
Add Comment
Please, Sign In to add comment