Multiple Logical Operator Issues ...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Multiple Logical Operator Issues ...
# 1  
Old 05-14-2007
Data Multiple Logical Operator Issues ...

Hi folks
I have a snippet of code Which is like this

If ( ( A || B || C ) && D ) then
Do some thing....
elif exit
fi


Quote:
[ "$cur_scope_basis_measure" = "Account USVP PLC EOL" ] ||
[ "$cur_scope_basis_measure" = "Account USVP PLC RAMPUP" ] ||
[ "$cur_scope_basis_measure" = "Account SP Split % PLC EOL" ] ||
[ "$cur_scope_basis_measure" = "Account SP Split % PLC RAMPUP" ] &&
[ "$cur_scope_path_location" = "SalesUnit" ];

How to rephrase this and use it so I dont get any Errors ...

Looking out for helpful replies ..

Thanks & Regards
Srikanth GR
# 2  
Old 05-14-2007
Code:
if [ \(    "$cur_scope_basis_measure" = "Account USVP PLC EOL"          \
        -o "$cur_scope_basis_measure" = "Account USVP PLC RAMPUP"       \
        -o "$cur_scope_basis_measure" = "Account SP Split % PLC EOL"    \
        -o "$cur_scope_basis_measure" = "Account SP Split % PLC RAMPUP" \
     \) -a "$cur_scope_path_location" = "SalesUnit" ] 
then
   : #Do some thing....
else
   exit
fi


Jean-Pierre.

Last edited by aigles; 05-14-2007 at 05:34 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to use logical operators in multiple if statement

Hi I want to send a status mail if daily or weekly or monthly batch completed or aborted. Here is the code. if && && || Else if && && || Else if && && || then mailx –s “Status Report” sumone@sumthing.com else print ”try again” Plz suggest the changes. (3 Replies)
Discussion started by: Avi
3 Replies

2. Shell Programming and Scripting

How to use logic NOT operator for multiple AND conditions

Hi, my requirement is that my builds should not be built if the current hour is greater 3 but not (between 12 and 15), I'm trying to write a shell script for this but there is always an error hour=$1 echo "hour:$hour" if && ! && ]; then echo "exit" else echo "enter" fi ... (9 Replies)
Discussion started by: kgsrinivas
9 Replies

3. Shell Programming and Scripting

Filtering issues with multiple columns in a single file

Hi, I am new to unix and would greatly appreciate some help. I have a file containing multiple colums containing different sets of data e.g. File 1: John Ireland 27_December_69 Mary England 13_March_55 Mike France 02_June_80 I am currently using the awk... (10 Replies)
Discussion started by: crunchie
10 Replies

4. UNIX for Dummies Questions & Answers

issue with multiple logical operators

Hi, shell is /bin/ksh I am trying to do the following in my code.. but its showing me an error if ] && ] ]]; then echo "id is $ida and chk_dy is $chk_dy" fi the error I get is syntax error at line 23 : `"$ida"' unexpected I need to execute the... (2 Replies)
Discussion started by: nss280
2 Replies

5. Programming

Delete operator overloading with multiple arguments.

Hi, I have an requirement to overload the delete operator in C++, but it should also accept the sizeof() the object that is to be deleted. Actually I am trying to built a custom memory allocator and deallocator like a pool, which makes me to overload the delete operator. Small example of the... (1 Reply)
Discussion started by: kapilkumawat
1 Replies

6. Shell Programming and Scripting

op of logical operator

Why the op of the following code is like this ???? i=4 j=-1 k=0 echo $? echo $? echo $? (5 Replies)
Discussion started by: lipun4u
5 Replies

7. Shell Programming and Scripting

multiple conditions in if using && operator

VARIABLE="project" if && ] then echo "VARIABLE is not empty" fi this is not working what is wrong in the syntax?? (2 Replies)
Discussion started by: codeman007
2 Replies

8. HP-UX

routing issues with multiple NIC cards

I am running HP_UX 11.23 with 4 NIC cards (this is our TSM server) I have 4 subnets we are backing across. trying to keep traffic on their subnets. I only have one route statment should I add more. route add net 123.99.8.0 netmask 255.255.255.0 123.99.8.254 route add net 123.99.67.0 netmask... (2 Replies)
Discussion started by: myork
2 Replies

9. UNIX for Dummies Questions & Answers

multiple Logical statement

hi I have following if condition line_by_line="0000000000000tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" if then echo "Exclusion criteria" else echo "Not exclusion criteria" fi above condition works perfectley but if i add one more logical condition... (3 Replies)
Discussion started by: mahabunta
3 Replies
Login or Register to Ask a Question