Re: Passing variables to remote hosts through ssh



On Fri, 19 May 2006 16:12:06 -0400, Earthdog wrote:
For example, suppose I want to create a directory called /tmp/newdir on
100 hosts:

#/bin/ksh

DIRNAME=newdir

for i in `cat /long/list/of/hosts`

do
ssh $i '/usr/bin/mkdir /tmp/$DIRNAME'
done

This doesn't work, because $DIRNAME doesn't get passed to the remote host.


Try it with double quotes instead of single quotes. E.g.

ssh $i "/usr/bin/mkdir /tmp/$DIRNAME"

Single quoted strings get passed verbatim.

JohnK

.