LUNIX (PLEASE LABEL ANSWER)
- Create a new script, script5.sh, with the followingcode. When done, change its permissions to be 755.
#!/bin/bash
value=5
while[$value-gt0];do
value=$((value+1))
echo$value
done
Run thescript. It does not stop. Why not? You havean infinite loop. Type ctrl+c to exit the program.6) What iscausing the infinite loop (meaning the loop never ends)?
- Let’s look at a more complicated script.
- Write the following as script6.sh and change its permissions toexecutable. Pay very close attention to spacing!
#!/bin/bash
count=0
fornumin$@;do
if[$num-eq10];then
count=$((count+1))
fi
done
echoThe number10wasfound$counttimes
Run the scriptas./script6.sh102030104020501060.
7) What is the output? 8)Summarize what the script does.
OR
OR