Lunix Please Label Answer Create New Script Script5sh Following Code Done Change Permissio Q37108348

LUNIX (PLEASE LABEL ANSWER)

  1. 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)?

  1. Let’s look at a more complicated script.
    1. 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

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.