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 iftheelif 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

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

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

Define marketing concepts.

Answered: 1 week ago

Question

1 what does yellow colour on the map represent?

Answered: 1 week ago