Passing variables to remote hosts through ssh
- From: Earthdog <nobody@xxxxxxxxxx>
- Date: Fri, 19 May 2006 16:12:06 -0400
Hi,
I have a central administration server that has root-level public key access to my other hosts. I run scripts that use ssh to execute commands on all my hosts. How do I pass variables through ssh?
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. How can I make it work without hardcoding newdir in the ssh line?
Thanks.
.
- Follow-Ups:
- Re: Passing variables to remote hosts through ssh
- From: Unruh
- Re: Passing variables to remote hosts through ssh
- From: JohnK
- Re: Passing variables to remote hosts through ssh
- Prev by Date: Changing keys
- Next by Date: Re: Passing variables to remote hosts through ssh
- Previous by thread: Changing keys
- Next by thread: Re: Passing variables to remote hosts through ssh
- Index(es):
Relevant Pages
|
|