We Recommend

bash Cookbook: Solutions and Examples for bash Users bash Cookbook: Solutions and Examples for bash Users
bash Cookbook teaches shell scripting the way Unix masters practice the craft. It presents a variety of recipes and tricks for all levels of shell programmers so that anyone can become a proficient user of the most common Unix shell -- the bash shell -- and cygwin or other popular Unix emulation packages.


Posted By

tgunr on 03/14/07


Tagged

Bash osx


Versions (?)


Select terminal file


Published in: Bash 


  1. function term () {
  2. terms=`/bin/ls ~/Library/Application\ Support/Terminal/|grep -v ".*~"`
  3. if [ $# != 0 ] ; then
  4. let "count=0"
  5. for aterm in $terms; do
  6. termarray[$count]=$aterm
  7. let "count=$count+1"
  8. done
  9. selection=$1
  10. else
  11. let "count=0"
  12. for aterm in $terms; do
  13. case "$aterm" in
  14. [0-9]*) ;;
  15. * )
  16. termarray[$count]="$aterm"
  17. echo "$count: ${termarray[$count]}"
  18. let "count=$count+1"
  19. ;;
  20. esac
  21. done
  22. echo -n "Select term color: "
  23. read selection >/dev/null
  24. fi
  25. open -a /Applications/Utilities/Terminal.app ~/Library/Application\ Support/Terminal/${termarray[$selection]}
  26. }

Report this snippet 

You need to login to post a comment.