multiple condition in if

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting multiple condition in if
# 8  
Old 09-18-2009
Lateral thought. Maybe you were just trying to validate $z ?

for z in 1 2 3 4 5 6 7 8 9
        if [ ${z} -gt 5 -a ${z} -lt 7 ]
        echo "${z} : ${y}"


# 9  
Old 09-19-2009

I used methyl's code and is working fine. Thanks a lot for your inputs.
# 10  
Old 09-20-2009
Psychic or what?

Clarify the problem and the solution will become clear.
(Methyl Sep 2009)
# 11  
Old 09-20-2009

I said that I used your suggestion (if [ \( ${z} -gt 5 -a ${z} -lt 7 \) -o \( "${y}" = "VALID" \) ]) and it is working fine.
For that you are telling me psychic and all.
Mind your words in the forum.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Need help search multiple condition from a file.

OS: window 7 shell : korn shell I have 2 file , i'm need grep data according File_1 from file 2. File_1 CAL_ENAB_N_4_ $2N12743_29 +12V File_2 NODE CAL_ENAB_N_4_ PINS 21548; PROBES P1465 3651, 46900 tn2700.1 LWT; WIRES (6 Replies)
Discussion started by: kttan
6 Replies

2. Shell Programming and Scripting

Executing multiple scripts using if condition

I have an if condition. If that condition is true then one script will be run and after that I need to check another condition based on the output value of first script. i tried like below : cd lock if ; then rm exitup if ; then kb_shutdown kb_startup if ; then rm exitup if ;... (3 Replies)
Discussion started by: charanarjun
3 Replies

3. Shell Programming and Scripting

Reading multiple lines with condition

Hi guys, I need to read following lines and put them in same row …. text: Abcd5437_XYA0_B1_WXYZ_BE 99:00:14:42:55:01:d4:22 99:00:14:42:70:01:d4:22 99:00:14:42:55:03:a0:22 99:00:14:42:70:03:a0:22 ... (4 Replies)
Discussion started by: dc@bos
4 Replies

4. Shell Programming and Scripting

Multiple if condition

Hi, I wanted to satisfy two requirements to proceed to do a task One of them is to calculate between two metrics and the other to check one of the file not empty if the condition matches the above two, it should proceed with the task below is the snippet of it, however when i run the script... (3 Replies)
Discussion started by: ajothi
3 Replies

5. UNIX for Dummies Questions & Answers

LINUX Multiple condition in IF Statement - Pls help

Hi All, I am trying to put multiple conditions in an IF Statement (using $$). the Linux script somehow doesnt like it. The logic I am trying to implement is as follows, 1. I will first search for DateFile.txt 2. If it exists & there is a P_BUS_DATE value in it, then assign the date value... (5 Replies)
Discussion started by: dsfreddie
5 Replies

6. Shell Programming and Scripting

multiple condition matching and doing some predefined work

Hi everybody, I had 10 files in in one folder(/home/sai/) namely sai. 1.gz,2.gz,3.gz ..,10.gz. I want to delete the files which are there home based on the following conditions fliecount in sai folder==10 && grep -cv ".gz"==0 How to check this using awk? Otherwise please... (2 Replies)
Discussion started by: p_sai_ias
2 Replies

7. Shell Programming and Scripting

Multiple condition checking in bash

Hi All, I am trying to check if two variables have value assigned to it. i am doing it like if ] then echo "Please specify either single hostname or host file for the report" usage exit fi But its not working for it.Even i specify values for both variables it dont go... (6 Replies)
Discussion started by: kailash19
6 Replies

8. Shell Programming and Scripting

multiple echo statements in if condition

Hi , I have a peculiar problem. i have an if block like this if ; then echo " todays date is " ${date} >> log_file echo " file count is " $ count >> log_file mv filename1 filename 2 else echo "no files available ">> log_file fi the echo statement "no files available " is not... (2 Replies)
Discussion started by: wizardofoz
2 Replies

9. Shell Programming and Scripting

awk with multiple condition

Hi Guys, I just wanted to print all the lines execpt 1st and 3rd line. For that i wrote a awk command, awk 'NR != 1 || NR != 3 {print $0}' c.out the command is working if i give an equal to instead of not equal to. In the case of not equal to, it gives me the entire file. Can you... (18 Replies)
Discussion started by: mac4rfree
18 Replies

10. UNIX for Dummies Questions & Answers

Multiple Condition If statement

Hi, I would like to create an IF statement where if a variable is equal to at least one of 2 (or more) values then the script proceeds. For example: TEST_VAR=2 if ; then echo success! else echo failure fi I understand that the above syntax is wrong but I feel it must be close. Any... (1 Reply)
Discussion started by: msb65
1 Replies
Login or Register to Ask a Question