LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-27-2009, 06:22 AM   #1
bioinformatics_guy
Member
 
Registered: Aug 2008
Posts: 54

Rep: Reputation: 15
3 point if/else statement


In bash, the only if/else structure I can find is

if [ ] ; then


else


fi

What if I have three things I want to check, such as:

if [ ] ; then


elsif [ ] ; then


else

fi

Does this structure exist or do I just need to do some large nested if/else loop
 
Old 03-27-2009, 06:28 AM   #2
bioinformatics_guy
Member
 
Registered: Aug 2008
Posts: 54

Original Poster
Rep: Reputation: 15
Found it:

elif
 
Old 03-27-2009, 06:29 AM   #3
JulianTosh
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
Try the case statement:

http://www.softpanorama.org/Scriptin...tatement.shtml

Code:
case expression in
    pattern1 )
        statements ;;
    pattern2 )
        statements ;;
    ...
esac
 
  


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
Gnome Desktop makes 10 point font look like 64 point - how do I fix it? TonyC Linux - Desktop 5 03-03-2009 01:22 AM
LXer: Set up a SSH-based point to point connection LXer Syndicated Linux News 0 11-30-2008 10:50 PM
Problem with if statement in a find -exec statement romsieze Programming 2 10-02-2008 01:38 AM
Case statement with If statement cbo0485 Linux - Newbie 4 11-07-2007 09:05 PM
telnet not work in Point to Point connected FC6 boxes techteacher Linux - Networking 4 05-06-2007 10:50 AM


All times are GMT -5. The time now is 03:13 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration