Question

Provide two examples of conditional commands that can be used inside bash scripts:

Provide two examples of conditional commands that can be used inside bash scripts:

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The Example of Conditional command used inside bash is

1.If Condition

if condition is used when a particular statement is true.

example


if [ 10 -gt 7 ] // if condition if 10 is greater than 7 than it print hello

then

echo Hello //print hello

fi //end the if statement

output will be

Hello

2.If-else condition

if else condition is used when a if condition will not satisfy than it will print the else result

for example

if [ 7 -gt 10 ] // if condition if 7 is greater than 10 than it print hello otherwise it go to else part

then

echo Hello //print hello

else

echo Hi

fi //ends if else statement

Output will be

Hi

Please provide feedback

hit Like don't dislike if doubt than comment it

Thank You

Add a comment
Know the answer?
Add Answer to:
Provide two examples of conditional commands that can be used inside bash scripts:
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT