hello experts,
i am retrieving values in variables jobKey and jobName within my shell script. these values are returned to me within braces [ ] and i am using following command to remove those braces:
jobKeys=`echo $jobKeys | sed 's:^.\(.*\).$:\1:'`
jobNames=`echo $jobNames | sed 's:^.\(.*\).$:\1:'`
if there are two jobs my jobKeys and jobName variables consist comma separated values like
jobKeys=key-43321-4, key-99838-7
jobNames=job1, job2
I want to write a loop based on these variable values so that when the loops runs first time i should get following values in my variables:
jobKey=key-43321-4 and jobName=job1
and when loop runs second time my variable should have
jobKey=key-99838-7 and jobName=job2
I tried below but it goes into infinite loop:
while [[ -z ${jobKeys} && -z ${jobNames} ]]
do
jobKey=`echo ${jobKeys} | cut -d, -f$i`
echo " "
echo "$jobKey"
jobName=`echo ${jobNames} | cut -d, -f$i`
echo " "
echo "$jobName"
i=`expr $i + 1`
done
any ideas what my loop should look like?