if [ Utv = "$ENV" ]
then for domain in 1 2 3
do for wls in stop clean cfi start
do wls wls"$wls" "$domain"
[ stop != "$wls" ] ||
remove "$domain"
done
done
fi
The in ... field is an array assignment. You assign the loop's iterators there. You can use a preset array, or you can just build one in as I do here. It really does not make sense to go to the trouble of assigning some shell variable for the sole purpose of assigning a for loop array - its twice the work, and not as easy to keep track of. That is my just my opinion though, of course.
Anyway, the in ... field is actually optional, because there is a preset array that the for loop will default to using anyway - the shell's arg array. It is for this reason that I believe this kind of stuff makes more sense in a shell function.
wls_lp(){
for wls in stop clean cfi start
do for domain
do set -x -- "-${-:--}" ${-:+"--"} "$@"
wls "wls$wls" "$domain"
[ stop != "$wls" ] ||
remove "$domain"
{ set +x "$@"; } 2>/dev/null
done;done
}
If you put that function in your script you can just run the whole loop over a list of domains like:
if [ Utv = "$ENV" ]
then wls_lp domain1 domain2 domain3
fi