in reply to ssh system command
I'm sure ` means something totally different than " to the remote shell. The $ in $i also needs to be escaped (or else Perl will try to interpolate its variable).
@data = `ssh $key 'for i in \`ls /home/dist/\` ; do cat \$i ; done'`;
or
@data = qx!ssh $key 'for i in `ls /home/dist/` ; do cat \$i ; done'!;
However, isn't
for i in `ls /home/dist/` ; do cat $i ; done
the same as
cat /home/dist/*?
If so, the following would be simpler.
@data = `ssh $key 'cat ls /home/dist/*'`;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: ssh system command
by Anonymous Monk on Sep 11, 2007 at 20:59 UTC |