Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

2. (1 point) Given AABC, tan A b b

Answered: 1 week ago

Question

KEY QUESTION Refer to columns 1 and 6 in the table for question

Answered: 1 week ago