[olug] Bash script

Brian Roberson roberson at olug.org
Thu Oct 24 21:07:47 UTC 2002


depending on the logic you want........


for i in 1 2 3 4 ; do
    for r in 5 6 7 8 ; do
            echo $i:$r
    done
done

example output:
####
1:5
1:6
1:7
1:8
2:5
...
4:8


####




----- Original Message ----- 
From: "ERIC MAHLAKO" <lericom at yahoo.com>
To: <olug at olug.org>
Sent: Thursday, October 24, 2002 8:45 AM
Subject: [olug] Bash script


> Hi
> 
> Can anyone help me with the following problem:
> I have two conditions which I want to check
> simultaneously in order to do some other things in
> bash script, i.e I want to do something similar to the
> following:
> condition1 = "1 2 3 4 5 6"
> condition2 = "9 8 7 6 5 0"
> 
> for cnd1 in condition1 && for cnd2 in condition2
> do 
> ....
> ....
> ....
> done
> but it can compile,it gives me a syntax error. I want
> to know if it is possible to combine two for loops
> with an "AND" or "OR" in basch script. If yes let me
> know.
> 
> Thanks
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Y! Web Hosting - Let the expert host your web site
> http://webhosting.yahoo.com/
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
> 



More information about the OLUG mailing list