HOMEWORK ASSIGNMENT
I am creating a bash Menu script that would prompt a user to select options. Option 4 is for changing directory. I have accomplished this by using the following:
change_directory () {
read -p ' Please enter your directory :' dir
cd "/$dir"

But my question is, what if the user inputs a directory that isnt in the / path? How could I go from there? I have no clue in how to do that. So i need your help guys.
thank you in advance