Question
Task 01 (10 points) Variable manipulation Write a Bash script that takes in the following the following information and outputs it in the given format:
Task 01 (10 points)
Variable manipulation
Write a Bash script that takes in the following the following information and outputs it in the given format:
-
Users name
-
Current date
-
City name
-
Temperature
-
Name of that days birthday
-
Current payable bill balance
Example input | Example output |
Enter your name: Professor Enter the date: 2026/08/04 Enter your city: Allendale, California Enter the current temperature: 117 Enter todays birthday: Mr. Featherstone Enter your payable bills: 16459 | Good day, Professor. Today is August 4, 2026 in the city of Allendale, California. It is a beautiful Tuesday, the temperature is 117 degrees. Today is Mr. Featherstone's birthday. Insurance is payable, as are the water, gas, and light bills for a total of $16459 |
Note: theres one piece of information you need to output that is not given, how do you think you could get that information?
Task 02 (10 points)
read command and variable manipulation
Write a Bash script that will take in two numbers as input and add them together
Example input | Example output |
Enter the first number: 52 Enter the second number: 15 | The sum of 52 and 15 is 67 |
Task 03 (20 points)
Functions and conditionals
Write a Bash script that will take in two numbers and an operator as input and then perform the given operation. It should be able to handle the following: adding, subtracting, multiplying, dividing, exponentiation, and Modulo.
Example input | Example output |
Please select one of the following: add sub mul div exp mod Enter the operator: mod Enter the first number: 52 Enter the second number: 15 | The mod of 52 and 15 is 7 |
Task 04 (30 points)
Loops and conditionals
Write a Bash script that accepts a list of integers and adds them together. Use a loop and the shift command to allow for an unlimited number of integers to be provided as arguments.
Example input | Example output |
lab03-part04-ASURITE.sh 1 2 3 lab03-part04-ASURITE.sh 20 30 100 50 lab03-part04-ASURITE.sh 9000 1 lab03-part04-ASURITE.sh 5 | 6 150 9001 5 |
Task 05 (30 points)
Loops, functions, and conditionals
Write a Bash script that accepts an operator and a list of integers and performs the operation on the list. The script should be able to handle adding, subtracting, multiplying, dividing, exponentiation, and Modulo. Use a loop and the shift command to allow for an unlimited number of integers to be provided as arguments.
Example input | Example output |
lab03-part04-ASURITE.sh add 1 2 3 lab03-part04-ASURITE.sh sub 20 30 100 50 lab03-part04-ASURITE.sh mul 9000 1 lab03-part04-ASURITE.sh div 10 5 | 6 -160 9000 2 |
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