Question: Task 01 (5 points) Write a Bash script that will output the following information: number of positional parameters list of positional parameters only the second
Task 01 (5 points)
Write a Bash script that will output the following information:
-
number of positional parameters
-
list of positional parameters
-
only the second positional parameter
| Example input | Example output |
| ./MyScript Are you feeling it now | Number: 5 List: Are you feeling it now Second: you |
Task 02 (5 points)
Write a Bash script that will output the following information:
-
a 0 exit code
-
A non-0 exit code
| Example input | Example output |
| ./MyScript | Zero: 0 Non-Zero: 2 |
Task 03 (5 points)
Write a Bash script that will prompt for a name and then greet that name.
| Example input | Example output |
| What is your name? Professor | Hello there, Professor! |
Task 04 (5 points)
Write a Bash script that will return the following information using only variables:
-
The number of arguments
-
The full list of arguments
-
The name of the script file
-
The current user
-
The current working directory
-
The current $PATH variable
-
The current shell
| Example input | Example output |
| ./MyScript.sh 1 2 3 4 5 | 5 1 2 3 4 5 MyScript.sh Professor /home/professor /usr/local/bin:/usr/bin /usr/bin/bash |
Task 05 (5 points)
Write a Bash script that will use an if statement to accurately determine the appropriate actions for the given time of the year.
| Example input | Example output |
| Is it October? No Is it October? Yes | Okay. Then its time to get spooky! |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
