#!/bin/bash
until ["$userIn" = "j"]
do
echo "Welcome to the Menu_Script Program!"
echo
echo "Menu Options"
echo "Please Select an Option."
echo
echo
echo "Press a to use the Emailer Program"
echo
echo "Press b to Display the Users that are Currently Logged On"
echo
echo "Press c to Display the Current Date and Time"
echo
echo "Press d to Display the Months Calendar"
echo
echo "Press e to Display the name of the Working Directory"
echo
echo "Press f to Display the Contents of the Working Directory"
echo
echo "Press g to Find the IP of a Web Address"
echo
echo "Press h to See your Fortune"
echo
echo "Press i to Display a file on the screen"
echo
echo
echo "Press j to Exit this Menu"
echo
echo "Press m to show the Menu Options again"
echo
read mOption
case "$mOption" in
a|A)
echo "Welcome to the Emailer Program"
echo
echo "Please enter the content of your message and press <ENTER>:"
read $mContent
echo
echo "Please enter the email address of the recipient and press <ENTER>:"
read $mAddress
echo
echo "Is there a file to be attached to this message? Press Y/N:"
read $ATTACH
echo
if ["$ATTACH"="Y"|"y"]
then
echo "Please enter the name of the FILE to be attached:"
read $mAttach
mail -s "$mContent" "$mAddress"<"$mAttach"
echo
echo "Your mail will be sent with the attachment."
echo
else
mail -s "$mContent""$mAddress"
echo
echo "Your mail will be sent without an attachment."
echo
fi
echo "Select a new Option, press j to Exit or m to show the Menu Options:"
echo
;;
b|B)
echo "Here is a list of users that are currently logged on:"
w
echo
echo "Select a new Option, press j to Exit or m to show the Menu Options:"
echo
;;
c|B)
echo "The current date and time:"
date
echo
echo "Select a new Option, press j to Exit or m to show the Menu Options:"
echo
;;
d|D)
echo "Here is the current Months of the calendar:"
cal
echo
echo "Select a new Option, press j to Exit or m to show the Menu Options:"
echo
;;
e|E)
echo "Here is the name of the Working Directory:"
pwd
echo
echo "Select a new Option, press j to Exit or m to show the Menu Options:"
echo
;;
f|F)
echo "Here is the Contents of the Working Directory"
ls
echo
echo "Select a new Option, press j to Exit or m to show the Menu Options:"
echo
;;
g|G)
echo "Please type a Web Address whose IP Address you"
echo "would like to find, then press <ENTER>:"
read $mWeb
echo
echo "Here is the IP Address Information:"
nslookup $mWeb
echo
echo "Select a new Option, press j to Exit or m to show the Menu Options:"
echo
;;
h|H)
echo "Here is your Fortune for today!"
echo
fortune
echo
echo "Select a new Option, press j to Exit or m to show the Menu Options:"
echo
;;
i|I)
echo "Please enter the name of the file that you want to be displayed:"
read $mFile
echo
echo "Here is your file:"
cat $mFile
echo
echo "Select a new Option, press j to Exit or m to show the Menu Options:"
echo
;;
j|J)
echo "Thank you for using the Menu_Script Program!"
userIn = j
echo
;;
m|M)
echo "Menu Options"
echo "Please Select an Option:"
echo
echo
echo "Press a to use the Emailer Program"
echo
echo "Press b to Display the Users that are Currently Logged On"
echo
echo "Press c to Display the Current Date and Time"
echo
echo "Press d to Display the Months Calendar"
echo
echo "Press e to Display the name of the Working Directory"
echo
echo "Press f to Display the Contents of the Working Directory"
echo
echo "Press g to Find the IP of a Web Address"
echo
echo "Press h to See your Fortune"
echo
echo "Press i to Display a file on the screen"
echo
echo
echo "Press j to Exit this Menu"
echo
echo "Press m to show the Menu Options again"
echo
;;
*)
echo "Invalid Selection."
echo "Select a valid option, press j to Exit or m to show the Menu Options"
;;
esac
done
ベストアンサー1
[
命令だ。
したがって、他のコマンドと同様に、パラメータの後にスペースを追加して処理する必要があります。
努力するman [
。端末にこれを入力すると、
エラーと同じ内容を示す明示的に名前付きバイナリ/コマンドがないと機能しません。echofoo
echofoo
echofoo: command not found.