What will be the output of the following script?
#!/in/bash
secondLoop="A B C D E F G"
counter=0
for a in 6 7 8 9
do
for b in "$secondLoop"
do
let "counter+=1"
done
done
echo "This script has $counter iterations"
Options:
This script has 28 iterations.
This script has 21 iterations.
This script has 4 iterations.
This script has 0 iterations.
It should be 4 iterations, because there are quotes in
for b in "$secondLoop"
so that the variable is expanded to a single value (that included spaces).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.