I am new to bash shell scripting. Converting over to Linux before support for Windows XP fades into the sunset, I am redesigning and rewriting many scripts that worked using enhanced scripting language Take Command.
I am trying to evaluate whether a directory exists based on a list of directories in a text file. If I enter the following at the command line:
if [ -d "/media/D_Drive/Music/Rolling_Stones/1995-Voodoo_Lounge/" ]; then echo "True"; else echo "False"; fi
True echos to cli.
If I try:
while read line; do if [ -d "$line" ]; then echo "exists $line"; else echo "Does not Exist - $line"; fi done < /media/D_Drive/Music/Albums-linux.txt
all the values of $line come back as not existing
What am I missing? I have tried
[ -d "$line" ] with and without quotes. I know it does not have to do with possibility of whitespace in the sub-directory name for that triggers a too many arguments error.