I have a small test.sh script as follows:
#!/bin/bash
read -e -p "Enter a Directory: " directory
echo $directory
Here's what happens when I run it:
$ ./test.sh
Enter a Directory: ~/AA\ Directory/
/Users/<username>/A Directory/
I want to be able to keep the escaped space inside that variable so that the program output would read:
$ ./test.sh
Enter a Directory: ~/AA\ Directory/
/Users/<username>/A\ Directory/
Anyone know how to do this? The use for this is to tell the script where to look for files that it needs to read.
Edit: I forgot to put the \ in the second and third code selection.