Can anyone tell me why the cp section of the snippet below is not returning a value? That is the cp section, everything before that works fine, thanks for your input.
cp_files=`ssh -t $USERID@$RSYSTEM "cd $REMOTE_DIR; \
for files in \`cat $EXPORT_FILES\`; do \
echo cp \\$files $SOURCE_DIR; done"
Using ssh requires escaping the special characters ( $REMOTE_DIR, etc ...).
$REMOTE_DIR ---> \$REMOTE_DIR
I'd recommend using full paths, where possible, to avoid potential issues. Keep in mind that when you execute a ssh script you are working in a different environment.