In my script, I am holding the location (path) of a file as a variable.
For example, fileA
An example of its contents are
fileA=/usr/anotherfolder/somefold/"filenamehere"
However, when i call a command on the file in the script such as:
cat $fileA
or
cat "$fileA"
I get an error saying the file or directory doesn't exist. If I echo $fileA to see what the output is, and then run a cat manually from the terminal, it works fine, don't know what is going wrong. Any help?
Some debug info:
For these particular lines
echo $fileA
if [ ! -r "$fileA" ]
then
o=`expr $o + 1`
echo "$fileA not readable."
continue
fi
If file name is new
(not "new"
), then change
fileA='/home/jacob/Desktop/CS35L/WORK/2/hw/test3/"new"'
to
fileA=/home/jacob/Desktop/CS35L/WORK/2/hw/test3/new
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With