#!/bin/ksh
while :
do
clear
cat %26lt;%26lt;++
MAIN MENU
1) Delete a file
2) Rename a file
3) Find a file
4) Display contents of a file using cat
5) Edit a file using vi
6) List the contents of a directory
7) Print current directory
8) Print today's date and time
x) Exit
++
echo "Please enter your selecton $LOGNAME \c
read selection
case $selection in
1)
echo "Enter a filename: \c
read fname
if [ -r $fname ]
then
rm $fname
else
echo " menu: Cannot access file $fname"
fi
;;
2)
echo "Enter a filename: \c"
read fname
echo "Enter a new filename \c"
read frename
if [ -r $fn ]
then
cp $fname $frename
else
echo "menu: Cannot access file $fname"
fi
;;
3)
echo "Enter a filename: \c
read fname
find . -name "$fname" -print
;;
4)
echo "Enter a filename: \c
read fname
if [ -r $fname ]
then
cat $fname
else
echo "menu: Cannot access the $fname \c"
fi
;;
5)
echo "Enter a filename: \c"
read fname
if [ -r $fname ]
then
vi $fname
else
echo "menu: Cannot access the file $fname \c"
6)
echo "Enter a directory name \c"
read dname
if [ -r $dname ]
then
ls -l $dname
else
echo "menu: Cannot access directory $dname"
fi
;;
7)
pwd
;;
8)
date
;;
q|Q|e|ExX
exit 0
;;
*) echo "Invalid choice, Try again. ";;
esac
echo "Press enter to continue \c"
done
Syntax error on line 29 " ;; " unexpected?
Your "Enter a filename \c
lines don't have a closing quote mark.
Check for other missing quote marks -- the enter selection line is also missing one.
You also have some other syntax errors -- a missing ) on the quit line and a missing fi;; just before 6).
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment