Header Ads

Header ADS

Delete files from Backtrack

Delete files from Backtrack

Write a script that allows user to display a file on the monitor, delete a file, or quit the program.

Code
clear
let "a = 1";
while test $a -eq 1;
do
clear
echo " ====== File Viewing Program ====== "
echo " "
echo " Choose from the following: "
echo " 1 ; List all files "
echo " 2 ; Display a file on screen "
echo " 3 ; Delete a file "
echo " q ; Quit "
echo " "

echo -n "Enter Option: "
read c
clear
case "$c" in
1)
echo "Files in the present directory:"
ls
echo " "
read x
clear
;;
2)
echo "Enter the file name which you want to view "
read c
if (cat $c); then
read x
else
echo "File Not Found"
read x
fi
clear
;;
3)
echo "Enter the file name which you want to delete"
read c
if (rm $c); then
echo "File deleted successfully"
read x
else
echo "File Not Found"
read x
fi
;;
q)
exit 0
;;
esac
done

Screen Shot

Delete files from Backtrack

No comments

Powered by Blogger.