I am making a bash script to find a file/directory. I am begining bash and i picked this as a start to scripting. My script is not changing directories to root, it is but it isn't. I googled my problem and tried making a function like someone mentioned but it did not work for me.
I got rid of some comments for easier reading
#Find files and directories
User=$USER #variable for the enviromental variable $USER (Who you are)
PresDir=$PWD #Variable for the enviromental variable $PWD (Present working directory)
Root=/ #Variable for root directory
clear #Clears screen providing a clean slate to work on
Hello $User, enter a file to search for.
sudo find $Root $WANTEDFILE | grep $WANTEDFILE
$PresDir #Print Our Pres Directory
sleep 2 #Sleep 2 seconds before continuing commands
clear #Clears the screen presenting the food. . . file on a silver platter
ls -l $WANTEDFILE #Long lists the WANTEDFILE