Question: This script will check the length of an argument string. Name this script strlench.sh. #!/bin/sh # some comment slen=expr $1 : '.*' echo $1 $slen

This script will check the length of an argument string. Name this script strlench.sh.

#!/bin/sh # some comment slen=expr "$1" : '.*' echo $1 $slen if [ $slen -lt 4 ] ; then echo String too short elif [ $slen -gt 10 ] ; then echo String too long else echo Goldilocks fi

LR(10/18): (2 pts.) Read the man page for expr and figure out why the first line of the file computes the length of the commandl line argument, $1. Document this in your lab report.

LR(11/18): (2 pts.) Test the script, then modify it to test 2 command line arguments, the first argument ($1) should be 2 to 8 chars long, the second command line argument ($2) should be 5 to 8 chars long. Document and show the modified script running.

LR(12/18): (2 pts.) Create another error by removing the backticks from the expr and see what error you get. Document your results.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!