raise (613B)
1 #!/usr/bin/zsh 2 3 createmenu () 4 { 5 arrsize=$1 6 7 PS3="select window to raise: " 8 select option in "${@:2}"; do 9 if [ "$REPLY" -eq "$arrsize" ]; 10 then 11 echo "bye..." 12 break; 13 elif [ 1 -le "$REPLY" ] && [ "$REPLY" -le $((arrsize-1)) ]; 14 then 15 $(hidden -c | grep -i ${window_list[REPLY]} | awk -F: '{print $NF}' | tr -d "'") 16 break; 17 else 18 echo "no window. select a number 1-$arrsize" 19 fi 20 done 21 } 22 23 declare -a window_list=($(/usr/local/bin/hidden | awk '{print $1}' | tr '[:upper:]' '[:lower:]')) 24 25 window_list+=("quit") 26 27 createmenu "${#window_list[@]}" "${window_list[@]}"