Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this exercise, you will create a script called string_ops.sh that uses the various string operators The string_ops.sh script will Use one command line argument,

  • In this exercise, you will create a script called string_ops.sh that uses the various string operators
  • The string_ops.sh script will
  • Use one command line argument, which will be "Hello"
  • Assign the value of the first argument to a local variable called STRING. HINT: Look at line 5 in the example screenshot for arguments.sh
  • Use four IF THEN statement to compare the value of local variable STRING
  • Determine which string operators to use to produce the following output when run

WARNING: In the IF THEN statements, to avoid syntax error messages, there must be a space before and after each bracket and also between each element within the brackets.

The first IF THEN statement has the form

if [ "$STRING" operator "string" ]

then

echo ""

fi

  • Decide which operator to use in the comparison that produces the first message. Look at the slide "String Operators"
  • Decide what the value of string should be
  • Decide what the message should be
  • The second IF THEN statement has the form

if [ "$STRING" operator "string" ]

then

echo ""

fi

  • Decide which operator to use in the comparison that produces the second message. Look at the slide "String Operators"
  • Decide what the value of string should be
  • Decide what the message should be
  • The third IF THEN statement has the form

If [ operator "$STRING" ]

then

echo ""

fi

  • Decide which operator to use that produces the third message. Look at the slide "String Operators"
  • Decide what the message should be
  • The fourth IF THEN statement has the form

if [ operator "$2" ]

then

echo ""

fi

  • Decide which string operator to use that produces the fourth message. Look at the slide "String Operators"
  • Decide what the message should be

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

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions