I have a bash script that requires users to point to two different files like this:
echo "Path to file 1: "
read -e pathFile1
echo "Path to file 2: "
read -e pathFile2
The thing is, those two files will USUALLY be in the same directory and the way it is now, the user has to put the full path to each file which can be a bit of a pain if the files are deep at all.
How can I have the second prompt automatically start in the directory the user pointed to in the first prompt? Keep in mind, the user will be pointing to a FILE so it would look like "/home/user/files/important/file1.zip" and I need the second prompt to start at "/home/user/files/important/" (sans the "file1.zip" part).
I suppose it's also important that the user be allowed to go back directories just in case the files happen to not be in the same directory (should be rare).