Register
It is currently Fri Oct 24, 2014 5:09 pm

Using case statements


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Wed Oct 18, 2006 5:36 am   
User avatar

Joined: Mon Jul 03, 2006 8:58 pm
Posts: 52
Location: Rochester, NY
I have a fairly simple question: How do you let a case fall through in bash?

For example, I have the following code:

Code:
case ${arg} in
    -c)
    --configure)
        DOCONFIG="yes"
        ;;
    -v)
    --verbose)
        VERBOSE="yes"
        ;;
esac


It fails on --configure) with a syntax exception. I want to to execute --configure for either -c or --configure but it seems I shouldn't have to duplicate the code for a simple case fall-through.

Any help is appreciated, thanks!


Top
 Profile WWW  
 PostPosted: Thu Oct 19, 2006 10:40 am   
Site Admin

Joined: Tue May 17, 2005 7:31 pm
Posts: 251
Location: Georgia
Code:
case "${arg}" in
    "-c" | "--configure")
    "-v" | "--verbose")
esac


that should get you back on your way :wink:


Top
 Profile  
 PostPosted: Thu Oct 19, 2006 10:04 pm   
User avatar

Joined: Mon Jul 03, 2006 8:58 pm
Posts: 52
Location: Rochester, NY
Thanks!


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP