Skip to main content
formatting of script code
Source Link
Tim Kennedy
  • 20.2k
  • 5
  • 42
  • 58

I amrunning below script in KSH shell. I want to run the loop for 6 times to call Java program and in betwen if there is no exception found , then it should return =0. if in all the 6 iteration, we found any exception then it should return 3.

integer max=7;i=1

while [[ $i -lt $max ]] do Java call statement; error_cnt=$processing_file | grep -i excption | wc -l if (( $error_cnt == 0 )) then return_code=0; break else Continue with java call fi (( i = i + 1 )) done

integer max=7;i=1

while [[ $i -lt $max ]]
do
    Java call statement;
    error_cnt=`$processing_file | grep -i excption | wc -l `
    if (( $error_cnt == 0 ))
    then
        return_code=0;
        break
    else
       Continue with java call 
    fi 
    (( i = i + 1 ))
done

If in all the 6 iterations still we finds exceptions then it should return 3.

I amrunning below script in KSH shell. I want to run the loop for 6 times to call Java program and in betwen if there is no exception found , then it should return =0. if in all the 6 iteration, we found any exception then it should return 3.

integer max=7;i=1

while [[ $i -lt $max ]] do Java call statement; error_cnt=$processing_file | grep -i excption | wc -l if (( $error_cnt == 0 )) then return_code=0; break else Continue with java call fi (( i = i + 1 )) done

If in all the 6 iterations still we finds exceptions then it should return 3.

I amrunning below script in KSH shell. I want to run the loop for 6 times to call Java program and in betwen if there is no exception found , then it should return =0. if in all the 6 iteration, we found any exception then it should return 3.

integer max=7;i=1

while [[ $i -lt $max ]]
do
    Java call statement;
    error_cnt=`$processing_file | grep -i excption | wc -l `
    if (( $error_cnt == 0 ))
    then
        return_code=0;
        break
    else
       Continue with java call 
    fi 
    (( i = i + 1 ))
done

If in all the 6 iterations still we finds exceptions then it should return 3.

Source Link
John
  • 73
  • 1
  • 6

ksh break and continue based on values

I amrunning below script in KSH shell. I want to run the loop for 6 times to call Java program and in betwen if there is no exception found , then it should return =0. if in all the 6 iteration, we found any exception then it should return 3.

integer max=7;i=1

while [[ $i -lt $max ]] do Java call statement; error_cnt=$processing_file | grep -i excption | wc -l if (( $error_cnt == 0 )) then return_code=0; break else Continue with java call fi (( i = i + 1 )) done

If in all the 6 iterations still we finds exceptions then it should return 3.