[OT] run command via ssh - problem
Dan Track
dan.track at gmail.com
Wed Nov 4 13:13:56 UTC 2009
On Wed, Nov 4, 2009 at 1:10 PM, Dan Track <dan.track at gmail.com> wrote:
> Hi,
>
> I'm running a command like this:
>
> for i in server1 server2;do ssh root@$i "`hostname`";done.
>
> However the hostname command always outputs the hostname of the server
> that the above command is run from. I'd like to know how to run this
> hostname command so that it actually runs on server 1, server2 etc..
>
> Thanks
> Dan
>
Sorry just to add the actual script was like this:
for i in server1 server2;do ssh root@$i "DNSNAME=\"basename
\`hostname\`\";echo $DNSNAME";done
Thanks
Dan
More information about the fedora-list
mailing list