Question: Bash programming 1 . Write a script to read in three numbers as arguments, compare them, and list them in an ascending order. $ ex

Bash programming
1. Write a script to read in three numbers as arguments, compare them, and list
them in an ascending order.
$ ex1301045
103045
2. Write a command menu as follows:
$ ex2
Command Menu
a. Current date and time
b. Users currently logged in
c. Name of the working directory
d. Contents of the working directory
Enter a, b, c, or d:
The function for each selection is as indicated in the menu.
3. Write a script to read in an odd number n as an argument and calculate
the arithmetic summation 1+3+5+7+....+ n.
(hint: Use the looping statement.)
$ ex311
The sum is 36.
4. Write a script to read in a number n as an argument and calculate its factorial
n! where n!= n x (n -1) x (n -2)
$ ex46
Factorial 5 is 120
5. Write a script to back up multiple files into a directory, create the directory if the
directory doesn't exist, and display the message indicating the number of files has
been successfully backed up. The last argument to the script is the directory.
$ ls
foo1 foo2 foo3 foo4 foo5 foo6
$ ex5* progs
The directory progs is created.
6 files have been backed up into the directory progs.
$ ls
foo1 foo2 foo3 foo4 foo5 foo6 progs
$ ls progs
foo1 foo2 foo3 foo4 foo5 foo6
6. Write a script to read in at least ten scores, sorts them, prints them out in an
descending order, and calculate their sum and average.
$ ex6
Input 10 scores: 89536290887477869591
Ordered scores: 95919089888677746253
The sum of all the scores is 805.
The average is 80.5.
7. Write a command menu as follows:
$ ex7
Command Menu
a. Enter a welcome message and write this message to a file msg.
b. Send the contents of the file msg to all users who are logged in.
Enter a, b :
The function for each selection is as indicated in the menu.
(hint: b. Use the mail command. For example, mail username < msg.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!