LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-01-2014, 03:50 AM   #1
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 209
Blog Entries: 1

Rep: Reputation: Disabled
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

~
 
Old 03-01-2014, 03:53 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
See for yourself how you misinterpreted things?
Code:
select choice in "Test VPN " "Test APN" "Exit"; do
 case "$choice" in
  *) echo "$choice"
     ;; 
 esac
done
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL the syntax to SELECT doesn't work for DELETE Melsync Programming 2 03-31-2007 05:59 AM
DVD menu - doesn't work/can't select anything pingu Linux - Software 3 10-31-2005 09:33 AM
Using Select to make a simple directory menu why doesn't it work ctrimble Programming 5 06-07-2004 01:21 AM
Cut(Select) and Paste doesn't work! andykerouac Linux - General 0 02-11-2004 02:32 PM
why doesn't dhcp work in this case? josejcs Linux - Newbie 1 11-10-2003 07:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration