Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

1. Write a script that generates two random numbers between 1 and 10 and if the numbers match then prints Match Found else prints Different

1. Write a script that generates two random numbers between 1 and 10 and if the numbers match then prints “Match Found” else prints “Different Numbers”. You can use $RANDOM to generate the random numbers.

2. Write a script that takes one number between 1 and 10 from the user as an argument to the command and checks if a randomly generated number between 1 and 10 matches the user supplied number. The program first checks to see if only one argument has been provided by the user otherwise flags that an error.

$ your_script 5 #will tell you if the computer also generated the same number

$ your_script #will tell you that no args were supplied

You can use $# to check for the number of supplied args.

3. Write a script that checks to see if at least one argument has been given on the command line and tests whether the argument is the name of an ordinary file (not a directory or other type of file) in the working directory.

4. Write a script that uses case statement to do print Agreed, Disagreed, or Invalid Input when the user is asked to respond as Y or N on a question. Yes and No are also valid inputs and any combination of uppercase and lower case for all possible responses.

5. Write a script using if…the…elif to compare three words entered by the user and compare if any two match.

6. Write a script using the for loop construct that lists the names of the directory files in the working directory by looping through the files in the working directory and using test to determine which files are directory files.

7. Write a script using the while loop construct that generates 100 randomly generated numbers between 0 and 99 and writes them out in a user specified filename.

8. Repeat #7 with until loop.

Step by Step Solution

3.38 Rating (160 Votes )

There are 3 Steps involved in it

Step: 1

1 binbash Program generates two random numbers and checks whether they are equal or not Generate a number between 0 9 var1 echo RANDOM 10 bc Since we ... 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

Document Format ( 2 attachments)

PDF file Icon
60961d13a99bc_26618.pdf

180 KBs PDF File

Word file Icon
60961d13a99bc_26618.docx

120 KBs Word File

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

Discovering Advanced Algebra An Investigative Approach

Authors: Jerald Murdock, Ellen Kamischke, Eric Kamischke

1st edition

1559539844, 978-1604400069, 1604400064, 978-1559539845

More Books

Students explore these related Programming questions