Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I want to evaluate to see of some condition is true and if so then output a message. If not then output another message. What


I want to evaluate to see of some condition is true and if so then output a message. If not then output another message. What would I write?

a. if true; then

echo "it is true"

fi

b. if true; then

echo "it is true"

fi

if true; then

echo "it is true"

fi


c.if true; then echo "it is true"

else echo "it is false" fi

d. none of the above.

QUESTION 2

What operator returns true if an expression is false, and it returns false if an expression is true a. &&

b.||

c. !

d.-o


QUESTION 3

I have a loop that goes through a list of unique names. I want the loop to stop when it finds a certain name. What command would I use for that

a.found

b.break

c.continue

d.stop


QUESTION 4

I want to compare the two variables shown below to see if they are equivalent. What would I write?


str="5" int=5


a. if [$str -eq $int]; then echo "there are the same" else echo "they are not the same" fi

b. if [$str = $int]; then echo "there are the same" else echo "they are not the same" fi

c. if (($str == $int)); then echo "there are the same" else echo "they are not the same" fi

d. none of the above

QUESTION 5

I want to be able to us an if statement to evaluate a string using a regular expression. What syntax would I use?

a. if ["$string" =+ someregex]; then

echo "some result"

fi

b. if [["$string" =~ someregex]]; then

echo "some result"

fi

c. if [

{"$string" =$ someregex}; then

echo "some result"

fi

d. none of the above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Solution 1 c if true then echo it is true else echo it is false fi This is the correct syntax for ev... 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

Precalculus Concepts Through Functions A Unit Circle Approach To Trigonometry

Authors: Michael Sullivan

5th Edition

0137945139, 9780137945139

More Books

Students also viewed these Programming questions

Question

What are the main components of the fraud risk assessment process?

Answered: 1 week ago

Question

What is the biggest strength of the program?

Answered: 1 week ago