I am using Ubuntu server
and I want to create BASH
script that would help me to navigate through directories at ease.
I found this piece of code and I am using:
#!/bin/bash
cd ~/ftp/server/googledrive
prompt="Please select a file:"
options=( $(ls -1) )
PS3="$prompt "
select opt in "${options[@]}" "Quit" ; do
if (( REPLY == 1 + ${#options[@]} )) ; then
exit
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
echo "You picked $opt which is file $REPLY"
break
else
echo "Invalid option. Try another one."
fi
done
However it only lists the directories, each of them having a corresponding number. Is it possible to make it in such a way that I can actually navigate through my directories?
EDIT: Thank you the comments. I should have done this when I created the post.
By "actual navigation" I mean this: the main goal was being able to select a .zip archive and unzip it in a specific folder, thus the navigation part. So you would have to navigate from Directory A to B and then to C. Starting from the first directory you would have all the directories listed and each of them having an unique number, by selecting a number you would then navigate to that specific directory. This would repeat until you would find the directory you need and then select an option like "Unzip here".