This is the script I'm working on, I'm finished except for "displaying a file using cat" I'm unsure of the "wording". I know it's
to view a file. I tried doing
Code:
echo "Enter a filename"
cat $fname
more $fname
I can't figure out what I missing.
I'm new to all of this and still tying too figure out all the commands. I would appreciate any insight you can give me.
Code:
#!/bin/bash
leave=no
while [ $leave = no ]
do
echo Hello $USER
cat <<++
MAIN MENU
1) Print current working directory
2) Delete a file
3) Rename a file
4) List all files in a current directory
5) Display contents of a file
6) Edit a file
7) Copy a file
8) Move a file
x) Exit
++
echo Please enter your selection $LOGNAME:
read selection
case $selection in
1) pwd;;
2) echo "Enter any $filename to be deleted"
read f1
rm $f1
echo $f1" is deleted";;
3) echo "Enter file to to rename"
read f1
echo "Enter new name of file"
read f2
mv $f1 $f2
echo $f1" is renamed as "$f2;;
4) ls -l;;
5) echo "Enter a filename"
read $fname
more $fname
;;
6) echo "enter any file to be edited"
read f1
vi $f1;;
7) echo "Enter $filename to copy"
read f1
echo "Enter filename2 to be copied"
read f2
#cat $f1 > $f2
cp $f1 f2
echo $f2" is copied from "$f1;;
8) echo "Enter $filename to move"
read f1
echo "Enter filename2 where to be moved"
read f2
mv $f1 $f2
echo $f1" has been moved";;
x) exit;;
esac
done
Exit 0