Question
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
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.
-----------------------------------------------------------------------------------------------------
Q2
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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started