Forum Moderators: bakedjake

Message Too Old, No Replies

Urgent Shell Scripting Project

Writing a shell script

         

shimeekapayne23

5:54 am on Dec 12, 2004 (gmt 0)

10+ Year Member



I AM WRITING A SHELL SCRIPT FOR MY CIS 105 UNIX COURSE AND I NEED HELP WRITING IT. IT WROTE WHAT THINK GOES IN THE SCRIPT BUT NEED ADDITIONAL HELP!
HERE ARE THE DIRECTIONS AND PSEUDOCODE GUIDE:
CREATE A SCRIPT THAT WILL DUPLICATE THE EFFECT OF THE rm -i command in a user friendly screen design. The script should tell what action has been taken. Use the following pseudocode as a guide:
TITLE
Deleting a file interactively
DESCRIPTION
This is the outline for deleting:
Get the filename from command line

If there is no file with that name
Print error message (File not found)
Otherwise
Ask if the user wants to delete the file
Read the user's choice (y/n)
If the choice is yes (y)
Remove the file and print a message
(File removed)

PLEASE HELP DUE MONDAY HERE'S A MY SCRIPT:

echo "Deleting a file Interactively"
echo
sleep 2
echo "Enter a filename:\c"
read answer
if [ "filename" ]
then
echo "Are you sure you want to delete this file?"
fi
echo "Input y for yes or no for no:\c"
read answer
if test "answer" = y
then
echo "File removed"
else
echo "File not Removed"
fi
echo
exit 0