Simple Bash Script (Ubuntu) needed -- 2

Job ID: 30645698

Budget: $10 – $30 USD

Look to create some informational Bash Scripting information with screenshots included. The instructions are:
INSTRUCTIONS

1. Write a script to check command arguments (3 arguments maximum). Display the argument one by one. If there is no argument provided, remind users about the mistake.

Provide a screenshot of your script and example run (#4-0a)

Is there an easy way to use a loop to get all arguments?


2. Practice a simple command line calculator. See the sample output on the right.
Use the read command twice to prompt users to enter two integer numbers. Save them to two variables.
Display the sum, difference, and product of these two numbers. - Hint: use
$[ ] to force numeric calculation; example: $[$num1+$num2] Write a script to do a little file count report for a given directory, as shown in the following figure.

Provide a screenshot of your script and example run (#4-0b)

3. Write a script to display numbers from 1 to n, where n is an integer provided by users (if not, default to 10). Hint: use “read” command to accept user input.
Provide a screenshot of your script and example run (#4-0c)
4. Create x empty files in a given directory (x is a number), following a naming format like this: myfile1, myfile2, etc. Ask the user to enter the first part file name and the number of files he/she wants to create. Hint: you may use the “touch” command to quickly create empty files. Take two screenshots:
a) Display the source code in an editor (#4-1)
b) Execute your script in the terminal, and display the command and the result (#4-2)

5. Write a script to create the following directory structure in a directory of user’s choice. The user can supply the directory of choice as an argument; if missing, prompt the user to enter one from the command line. Take two screenshots:
a) Display the source code in an editor (#4-3)
b) Execute your script in the terminal, and display the command and the result (#4-4)

6. Edit the script in the prior question.
a) Check if the user input (an existing directory) is valid; if not, ask the user to enter it again.
b) If the “Data” directory exists, then prompt for user actions: cancel or overwrite. Hint: use directory operators; refer to lecture notes slide #8 and #10. Command line script on one line:

read -p "Enter a number: " max; sum=0; for ((i=1; i<=$max; i++)); do let sum+=i; done; echo "The sum from 1 to $max is $sum"
Related categories: Perl Script Install Linux Shell Script Bash Scripting