I create a file that may contain several full path name files on a remote Linux that are to be copied. This file, called AWKOUTPUT is created from another script.
It contains:
X/picture1.png
The script is very simple
-------------------------------------------
REMOTEDIR="/var/CC/Stuff"
for i in `cat AWKOUTPUT`
do
echo $i
scp user1@host:$REMOTEDIR/$i ./
done
--------------------------------------------
The scp fails indicating the file doesn't exist.
If I run scp manually it works fine, so the file does exist.
If I change the script to
--------------------------------------------
FILE="/var/CC/Stuff/X/picture1.png"
scp user1@host:$FILE ./
----------------------------------------------
it works fine.
If I add the -v option to scp the debug output cmd sent looks fine
debug1: Sending command: scp -v -f /var/CC/Stuff/X/Picture1.png
Sending file modes: C0644 739478 Picture1.png
Any suggestions ?