Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment: Create a shell script and Perform linux commands. Write a shell scri

ID: 3737786 • Letter: A

Question

Assignment: Create a shell script and Perform linux commands.

Write a shell script that does the following:

Use best practices... comments, shebang, expected number of arguments, exit codes, etc

Prompts the user to enter their name

Depending on the time of day, output a greeting that says either "Good Morning xxx", "Good Afternoon xxx", or "Good Evening xxx" (with "xxx" as their name)

Have a 10 second "count down timer" that displays the message "This message will self destruct in xx seconds". The message should repeat on the same line

Display a "Boom!" message on a new line

Explanation / Answer

#!/bin/bash
echo "Enter your name"
read username
cur_time=$(date +%H%M%S)
if [$cur_time -ge 000000 - a $cur_time -le 115959]; then
echo good morning $username
#elif [$cur_time -ge 120000 - a $cur_time -le 155959]; then
echo good afternoon $username
#elif [$cur_time -ge 120000 - a $cur_time -le 155959]; then
echo good evening $username
#else
echo good night $username
fi
echo "This message will self destruct in XX seconds"
for i in {10..01}
do
tput cup 10 $40 #here 10 is the row number of self desuct message and 40 is column numbr of XX
echo -n "$i"
sleep 1
done
exit 0

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote