Overview:
I want to code a function that will keep on executing till the value is equal to 0 and if the value is greater than 0, I'm writing the value into file and break-ing the loop.
Problem:
If the function is executed 8 times then while exiting the function in case the value is greater than 0 then 8 times the value is written into the file instead of 1 time. Kindly help me with the issue I'm facing.
PFB the code used,
#!/usr/bin/ksh
fx_Running()
{
v_line=$1
v_SRC_NM=$2
v_VAR =`echo $v_line|awk -F',' '{print $1}'`
v_STATUS=`wc -l $v_VAR | awk '{print $1}`
if [ $v_STATUS == 0 ]
then
fx_Running $v_line $v_SRC_NM
fi
if [ $v_STATUS == 1 -o $v_STATUS == 2 ]
then
${v_line} >> ${v_COMPLETED_LIST}
break
fi
if [ $v_JOB_STATUS == 3 ]
then
${v_line} >> ${v_FAILED_LIST}
break
fi
}
#!/usr/bin/ksh?