If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Help with case

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-31-04, 09:49
zeta_acosta zeta_acosta is offline
Registered User
 
Join Date: Mar 2004
Posts: 8
Help with case

can anyone tell me why when i type in a filename with an asterisk it does not go to the selected case, eg cannot have an asterisk.

Many Thanks!

for file
do
case $file in
*.*.*)
echo Cannot have two dots
exit
;;

*'*'*)
echo Cannot have an asterisk
exit
;;

*)
echo This is a file
;;

esac
done
Reply With Quote
  #2 (permalink)  
Old 03-31-04, 11:11
aigles aigles is offline
Registered User
 
Join Date: Jan 2004
Location: Bordeaux, France
Posts: 319
Try something like this :
Code:
for file
do
   case $file in
      *.*.*)
         echo Cannot have two dots
         exit
         ;;
      *\**)
         echo Cannot have an asterisk
         exit
         ;;
      *)
         echo This is a file
         ;;
   esac
done
__________________
Jean-Pierre.
Reply With Quote
  #3 (permalink)  
Old 03-31-04, 11:15
zeta_acosta zeta_acosta is offline
Registered User
 
Join Date: Mar 2004
Posts: 8
Quote:
Originally posted by aigles
Try something like this :
Code:
for file
do
   case $file in
      *.*.*)
         echo Cannot have two dots
         exit
         ;;
      *\**)
         echo Cannot have an asterisk
         exit
         ;;
      *)
         echo This is a file
         ;;
   esac
done
Many Thanks I will try it!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On