Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. ssh() {
  2. #get last argument
  3. for HOST; do true; done
  4.  
  5. #if it's not an alias just use white
  6. if [[ $HOST == *"@"* ]]; then
  7. COLOR=7
  8. else
  9. #read in config to find color for alias
  10.  
  11. #start color from blue
  12. COLOR=1
  13. while read line; do
  14. if [[ $line == "Host "$HOST* ]]; then
  15. break
  16. elif [[ $line == "Host "* ]]; then
  17. COLOR=$((COLOR+1))
  18.  
  19. if [[ $COLOR -gt "6" ]]; then
  20. #don't use white for custom hosts
  21. COLOR=1
  22. fi
  23. fi
  24. done < ~/.ssh/config
  25. fi
  26.  
  27. /usr/bin/ssh -t "$*" 'tput bold && tput setf '$COLOR'; bash -l'
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement