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_2

Step: 3

blur-text-image_3

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

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions

Question

Present a combinatorial explanation of why Ft r, n

Answered: 1 week ago

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago