LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   question on shell scripting and multi-directional conditional branching (https://www.linuxquestions.org/questions/linux-newbie-8/question-on-shell-scripting-and-multi-directional-conditional-branching-695836/)

jonhanna 01-08-2009 07:52 AM

question on shell scripting and multi-directional conditional branching
 
I am trying to find out the difference between definite and indefinite loops in shell scripting. I know about loops from my programming class but I cannot find anything on definite and indefinite loops. If someone could point me in the right direction that would be great?

My second question is what is multi-directional conditional branch? and what is the command you type to use this? I honestly have no idea what this is and if one of you guys could shine some light that would be great. thanks

pixellany 01-08-2009 08:01 AM

jonhanna;

I am glad to see you asking homework questions in a rational manner. One thing you need to do is be sure and follow-up in threads you start---eg here:
http://www.linuxquestions.org/questi...5/#post3398774

In that thread, you left us hanging---wondering if you ever solved the problem.

You current questions will be pretty easy to find on Google. I'll give you a hint on #2: There are two basic constructs:
case (aka "switch" in C)
if / elif ("else if" in some languages)

In your previous thread I recommended the Bash Guide for Beginners. That will cover these two approaches.

jonhanna 01-08-2009 08:18 AM

I guess I am not understanding what you mean by your answer, sorry lol is there any way to go into further detail?

jonhanna 01-08-2009 08:26 AM

I have just figured out the first question, I was just typing the wrong things, I am still clueless on the second though.

H_TeXMeX_H 01-08-2009 09:09 AM

Quote:

Originally Posted by jonhanna (Post 3401073)
My second question is what is multi-directional conditional branch? and what is the command you type to use this? I honestly have no idea what this is and if one of you guys could shine some light that would be great. thanks

Typically you would use a "switch" in C or a "case" in bash. See here:
http://tldp.org/LDP/abs/html/testbranch.html#EX29

It's like an extended 'if' 'elif' 'else' statement, in a more user-friendly readable format, testing to see if the variable matches the condition in each case, if it does then the command there is run.

jonhanna 01-08-2009 09:33 AM

thank you very much guys, I really appreciate all of the links as well, since I joined this site my favorites have grown 10 fold lol

pixellany 01-08-2009 02:00 PM

Quote:

Originally Posted by jonhanna (Post 3401098)
I guess I am not understanding what you mean by your answer, sorry lol is there any way to go into further detail?

If you are referring to "case" and "if - elif", then the documents you've been referred to have all the details.

Try to post specific questions--eg exactly what you don't understand.

jonhanna 01-09-2009 07:24 AM

Alright I appreciate it, I getting there step by step. lol

chakka.lokesh 01-09-2009 07:41 AM

Quote:

Originally Posted by jonhanna (Post 3402274)
lol

Is it necessary to laugh that many times?

jonhanna 01-09-2009 07:52 AM

is it necessary for you to even comment on this thread, no

H_TeXMeX_H 01-09-2009 08:33 AM

lol, lol

pixellany 01-09-2009 10:58 AM

OoooooooooKay....so the question has been answered and the conversation has degenerated into (whatever)

Closed


All times are GMT -5. The time now is 11:50 AM.