[OT] run command via ssh - problem

Todd Zullinger tmz at pobox.com
Wed Nov 4 13:32:52 UTC 2009


Dan Track wrote:
> Thanks for that, any thoughts on how it fits in with my script:
>
> for i in server1 server2;do ssh root@$i
> "DNSNAME=\"basename\`hostname\`\";echo $DNSNAME";done

What are you trying to achieve with DNSNAME=\"basename\`hostname\`\";
anyway?  If you want the domainname, dnsdomainname or hostname -d seem
better.  The basename command is for finding the base name of a file.

If the domainname is what you want, something like this would work:

for i in server{1..2}; do
    ssh root@$i 'DNSNAME=$(hostname -d); echo $DNSNAME'
done

I presume you have other steps in between DNSNAME=... and the echo,
otherwise you would just use ssh root@$i hostname -d.

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I look up to the heaven's for a ray of hope to shine.
And there it is in neon: Liquor, beer, and wine.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 542 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20091104/a5527a2d/attachment-0001.sig>


More information about the fedora-list mailing list