Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Trying to build a menu program in Putty. Keep getting errors andneed help fixing it: Basically: Line 3: $'r': command not found Line 6: $'r':

Trying to build a menu program in Putty. Keep getting errors andneed help fixing it:

Basically:
Line 3: $'r': command not found
Line 6: $'r': command not found
Line 8: $'r': command not found
Line 10: $'r': command not found
Line 31: syntax error near unexpected token '$'inr'
Line 31: 'case $userIn" in

I don't know if I;ve just been staring at it too long or what. ButI cannot figure out the issue.

Here is my code:

#!/bin/bash

until [ "$userIn" = "j" ] #loop that will keep the menu going untiluser
#selects j to quit it
or main menu
do
echo -e " Command Menu "
echo
echo "a. Emailer Program"
echo "b. Users Currently Logged On"
echo "c. Current Date and Time"
echo "d. This Months Calendar"
echo "e. Current Working Directory"
echo "f. Contents of Working Directory"
echo "g. Find the IP of a Web Address"
echo "h. See your Fortune"
echo "i. Print a File (on the screen"
echo "j. Exit Menu"
echo

#User will need to select which function they want to go with
echo -n 1 -p "Please select a letter from the menu: "
case "$userIn" in

#function used to collect the users subject, email address theywant to send to
#and the file they want to attach
a|A) echo
echo -n "Please enter the subject of your message: "
read userMessage
echo
echo -n "Please enter the email address you're sending to: "
read userAddress
echo
echo -n "Please enter the filename for the attachment: "
read emailFile
mail -s "$userMessage" "$userAddress" < "$emailFile"
echo
;;

#This function uses the who command to find who is currently loggedon
b|B) echo
who
echo
;;

#Using the date command to pull up current date and time
c|C) echo
date
echo
;;

#Using the cal command to show current months calendar
d|D) echo
cal
echo
;;

#using pwd command to pull up current working directory
e|E) echo
pwd
echo
;;

#command of ls to show what the contents of the working directoryare
f|F) echo
ls
echo
;;

#commands to look up the IP address of a webaddress
g|G) echo
echo -n "Please enter the web address to look up: "
read userAddress
echo
host "$userAddress"
echo
;;

#Command to produce a fortune for the user
h|H) echo
fortune
echo
;;

#command to pull up the contents of a file on screen
i|I) echo
echo -n "Please enter a filename to see its contents: "
read userFile
echo
;;

#command to exit the menu when the user is finished with it
j|J) echo
echo "Thank you for using this menu. Goodbye."
echo
;;
#final command a user can choose from to execute

#if the user has not selected j then the program will loop back tothe main menu

esac

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions

Question

53. 10 -6 -2 6 10

Answered: 1 week ago

Question

81. Review the building blocks of financial statement analysis.

Answered: 1 week ago

Question

811. How is the equity growth rate computed? What does it measure?

Answered: 1 week ago