I'm running this SSH command:
ssh -p 2001 -q [email protected] \
" echo
echo Now On Target Server, I see
ls -l /tmp/Folder-1.1.0.1053/*
for v in A B C ; do
echo === $v===
done
echo
for f in /tmp/Folder-1.1.0.1053/* ; do
echo File is == $f
done
"
and it's printing this:
Now On Target Server, I see
-rw------- 1 root root 159790 Jan 23 17:03 /tmp/Folder-1.1.0.1053/file1-1.8.30.tar.gz
-rw------- 1 root root 116731 Jan 23 17:03 /tmp/Folder-1.1.0.1053/file2-2.7.49.tar.gz
=== ===
=== ===
=== ===
File is ==
File is ==
I have a few questions:
- Why doesn't the first
forloop print the values of the variable$v? - Why (when I see the target server have valid files in
/tmp/<folder>) the secondforloop did not print the values of the$fvariable? - How can I get the second
forloop to print the two.tar.gzfiles? - I tried
$(...)or using back quotes to wrap the input values (forforloop) in the secondforloop but it has no effect. For some reason, it's expecting those*files using the local machine. Why?
If it's relevant, my Bash version is "GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)", and my Linux version is "Red Hat Enterprise Linux Server release 6.9 (Santiago)".