LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   case in a select doesn't work!!! (https://www.linuxquestions.org/questions/programming-9/case-in-a-select-doesnt-work-4175496631/)

massy 03-01-2014 03:50 AM

case in a select doesn't work!!!
 
when I try the code it only shows the menu and prompt!!! but it should do some jobs for any choice by case!!!
Code:

set -vx
DD=$(date --date="yesterday" +%a" "%b" "%d)
TIME=$(date +%T)
echo $DD
tabs -20
PS3="^[[32mPlease enter your choice: "
echo ^[[0m
select choice in "Test VPN " "Test APN" "Exit"
do
  case "$choice" in
    1) fping -ga 10.8.0.0/24>IPvar; usr=check; break;;
    2) fping -ga 192.168.40.0/24>IPvar; usr=root; break;;
    3) exit 0;;
  esac
done

cat IPvar
`^L`
while read IP
do
        rm -f rbtdate.txt
        rm -f rbt.txt
        ssh -n  $usr@$IP 'hostname;date +%T;last reboot|head -30'>rbt.txt
        echo ^[[36m
        cat rbt.txt|head -2|tr '\n' '\t'
        cut -c 40-50 rbt.txt>rbtdate.txt
        awk '$1=gensub("  "," 0",$1) ~ '/"$DD"/' {++c} END {print c}' FS=: rbtdate.txt
        echo ^[[37m
done <IPvar

~


unSpawn 03-01-2014 03:53 AM

See for yourself how you misinterpreted things?
Code:

select choice in "Test VPN " "Test APN" "Exit"; do
 case "$choice" in
  *) echo "$choice"
    ;;
 esac
done



All times are GMT -5. The time now is 08:16 AM.