until loop : running even if condition is satisfied


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers until loop : running even if condition is satisfied
# 1  
Old 11-04-2008
until loop : running even if condition is satisfied

I am checking one until loop with the following logic

until [ $job_status_ftp = $job_status_etl = $job_status_db = "SUCCESS" ]||
[ $job_status_db = "FAILURE" ]||[ $job_status_etl = "FAILURE" ]|| [ $job_status_ftp = "FAILURE" ]
do
sleep 30
done

before running this i am exporting above variables to SUCCESS.But the loop is running in infinite loop.My requirement is to make the loop run until
all the 3 variables are SUCCESS or any of the 3 variables is FAILURE.
Evan if the condition is satisfied the loop is running.

Furhter i am getting
[: =: unexpected operator/operand
error while running.Cn any one please check the code and let me know where is the issue
# 2  
Old 11-04-2008
Try this instead,

Code:
until [ "$job_status_ftp" = "SUCCESS" -a "$job_status_etl" = "SUCCESS" -a "$job_status_db" = "SUCCESS" ] ||
      [ "$job_status_db" = "FAILURE" -o "$job_status_etl" = "FAILURE" -o "$job_status_ftp" = "FAILURE" ]
 do
   sleep 30
 done

# 3  
Old 11-05-2008
Note - nothing inside the loop (sleep 30) will ever change the value of your variables
It can loop forever, depending on the variables' values.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

For loop/while condition - doubt

hi., As we know that using for-loop or while condition, we can only process one by one sequentially, but , lets say this example : 1. under the folder "logs" there are 1000 files 2. each file has one record or line 3. have to perform atleast 7 queries per 3 seconds ,for instance ... (3 Replies)
Discussion started by: alnhk
3 Replies

2. Shell Programming and Scripting

If both condition satisfied

pattern tin loop 3 tin xarg 1 tin jim 5 tin icon 2 tin tour 4 patn.out tin loop 3 tin jim 5 tin icon 1 tin tour 2 while read one two three do awk '$2 ~ /'"$two"'/' patn.out || while read four five six do awk -v n1=$three -v n2=$six '{BEGIN (n2<n1)?1:0}' done<patn.out... (3 Replies)
Discussion started by: Roozo
3 Replies

3. Shell Programming and Scripting

While Loop with if else condition

Hi, I was trying to write a shell script which reads csv file and sends mail in html format along with tables. Hope i have completed 1st part , but while sending mail i was trying to highlight some rows in the table based on the egrep outcome. If the string exists in line/INPUT, i am trying to... (4 Replies)
Discussion started by: varmas424
4 Replies

4. Shell Programming and Scripting

Use of -z in while loop condition

Hi, Could you please tell what is the meaning of -z in while loop condition. For example, while ; do echo "*** Enter the age " readage (3 Replies)
Discussion started by: vidyaj
3 Replies

5. Shell Programming and Scripting

if condition in a while loop

Gurus, I need to read a line from a file and strip the characters from it and compare the stripped value with the value I pass to the script while executing it. Below is the code for the same. But when i execute the code, it is throwing an error. #!/bin/ksh . /home/.i_env ... (14 Replies)
Discussion started by: svajhala
14 Replies

6. Shell Programming and Scripting

When running if condition, getting the following error

Hi All, My input file name is 1.sh the contents of file are cat status2.txt | while read filename do echo "$filename" echo "first content of the file is ${filename}" echo "second content of the file is ${filename}" echo "second content of the file is ${filename}" if } -eq 0 -a... (1 Reply)
Discussion started by: sunitachoudhury
1 Replies

7. UNIX for Dummies Questions & Answers

Changing old file name to new one if the old file name satisfied certain condition

Hi guys, I desperately need your help on my problem:- I got a folder in my directory that has many files in it. Most of the file's name is starting with certain prefix. Eg: ABC, CDE, EFG, etc. I only want to change file name that is starting from certain prefix and the rest I want them to... (1 Reply)
Discussion started by: balzzz
1 Replies

8. Shell Programming and Scripting

how to create folder wen the condition satisfied

hi i hav files ha1j ha2m ha3n ha4q ha5s ...like tat im having some 20 files ..and i want to create a folder as the same amount of files which im having wen the condition if loop is satisfied .. thank you (5 Replies)
Discussion started by: maximas
5 Replies

9. Shell Programming and Scripting

print remaining file after a condition is satisfied

Hi , could any one suggest me that how to determine if the first field is numeric and if it is greater than another number then from that point everything else should be printed using awk. I have tried this : awk -v xxxx=$xxxxx ' BEGIN { enable=0 } { print $1 if ( ( $1 !~ "^*$" ... (5 Replies)
Discussion started by: hitmansilentass
5 Replies

10. UNIX for Dummies Questions & Answers

Running scripts with condition

I have two scripts: SCR1 which takes between 5 seconds to 15 minutes and needs to be run every 23 minutes. SCR2 which needs to be run every 5 minutes but only if SCR1 is not running at that moment. How can I do this task? Best Regards /Hamid (3 Replies)
Discussion started by: Hamid Afsharazad
3 Replies
Login or Register to Ask a Question