|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hi
I'm trying to write a script with if (varable1 = x and variable2 = y and variable3 = z) then ..... I've tried using -a and it doesn't seem happy with this. Any help would be appreciated. |
|
#2
|
|||
|
|||
|
Code:
#!/bin/ksh
a=1
b=2
c=3
if [ $a -eq 1 ] && [ $b -eq 2 ] && [ $c -eq 3 ]; then
echo "yes"
fi
|
|
#3
|
|||
|
|||
|
the if statement is not easy, exactly in your situation (AND you have no OR statements).
in shells the -eq¦-lt¦le.... are NUMERICAL comparison operators in perl they are ALPHABETICAL in shell = is ALPHANUMERICAL in perl == is NUMERICAL as long you dont need ARITHMETICS, i mean if(2 >3) ... [ c notation] get rid of this using a faster tool: Code:
case $aa$bb$cc in 123) ;; *) exit ;; esac next code..... there is a paper in web, i dont remember, something like 'improve shells performance' , google for and read it. anyway this must work (on every shell, but csh) Code:
if [ $a -eq 1 -a $b -eq 2 -a $c -eq 3 ]; then if [ x$a = xAA -a x$b = xBB -a x$c = xCC ]; then
__________________
working on Solaris[5-9], preferred languages french and C. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > multiple ands |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|