I'm trying to list all the jobs in a folder and find the one containing a key word. The problem is that the job names contain spaces. Therefore, when I store the job list to a variable and try to loop through it, the foreach command sees each space as a new line. Any thoughts on storing a list of job names with spaces?
blcli_execute Job listAllByGroup "/BladeLogic/OS Patching"
foreach job in $JOB_LIST_BATCH
RESULT=`echo $job|grep -i Batch`
if [ "$RESULT" != "" ]
You need to change the input field separator, so just add
IFS=! (or something similar that should not occur in the job names)
at the beginning and it should then handle the spaces fine.