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

My unix class prof gave me this program to make through putty\'s vi to create a

ID: 3862431 • Letter: M

Question

My unix class prof gave me this program to make through putty's vi to create a bash script that does the following.

Welcome to Walter's (your name) main menu

1 -- Display users currently logged in
2 -- Display a calendar for a specific month and year (user is asked for a month and year to be displayed)
3 -- Display the current directory path
4 -- Change directory
5 -- Long listing of visible files in the current directory
6 -- Display current time and date and calendar
7 -- Start the vi editor (user will be asked which file to open if the file does not exist, then create new one)
8 -- Email a file to a user (use the emailer program created in assignment 6 but it will need a few error checks)
9 -- Quit

Make your selection:

Welcome to Walter's (your name) main menu

1 -- Display users currently logged in
2 -- Display a calendar for a specific month and year (user is asked for a month and year to be displayed)
3 -- Display the current directory path
4 -- Change directory
5 -- Long listing of visible files in the current directory
6 -- Display current time and date and calendar
7 -- Start the vi editor (user will be asked which file to open if the file does not exist, then create new one)
8 -- Email a file to a user (use the emailer program created in assignment 6 but it will need a few error checks)
9 -- Quit

Make your selection:

Explanation / Answer

Answer:

Please save the below code in .sh file like input.sh

#!/bin/sh

w
echo -n "Enter month and year > "
read month
read year
cal $month $year
pwd
ls -l
date
cal
echo -n "Enter the file name > "
read file
cat $file
if [ -f $file ]; then
read file
else
touch $file
fi
echo -n "Enter the file name and email address to send email > "
read file
echo "Hi" | mutt -s "Hi" mohank718@yahoo.com -a $file #pllease overwriter your email ID
echo "mail is send"
to excute run this command on terminal:

$ sh input.sh