Re: Passing variables to remote hosts through ssh
- From: JohnK <johnk.dev.null@xxxxxxxxx>
- Date: Fri, 19 May 2006 21:51:53 +0100
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
.
- Follow-Ups:
- Re: Passing variables to remote hosts through ssh
- From: Earthdog
- Re: Passing variables to remote hosts through ssh
- References:
- Passing variables to remote hosts through ssh
- From: Earthdog
- Passing variables to remote hosts through ssh
- Prev by Date: Passing variables to remote hosts through ssh
- Next by Date: Re: Passing variables to remote hosts through ssh
- Previous by thread: Passing variables to remote hosts through ssh
- Next by thread: Re: Passing variables to remote hosts through ssh
- Index(es):