[OT] run command via ssh - problem

Bryn M. Reeves bmr at redhat.com
Thu Nov 5 11:16:14 UTC 2009


On 11/04/2009 09:23 PM, Bill Davidsen wrote:
>> for i in server1 server2;do ssh root@$i "DNSNAME=$(basename
>> $(hostname)$);echo $DNSNAME";done
>              A      A
>              |      |
> what is that?       |

That's the closing paren for the nested shell expansion that begins with 
basename on the line above:

$(basename $(hostname))
  ^                    ^

The uselessness of basename in this situation has been pointed out but 
the syntax is just fine.

> need a backslash before the $

Not if you use single quotes as was already suggested.

Regards,
Bryn.




More information about the fedora-list mailing list