The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
etc host entry problem kandanathan SUN Solaris 5 06-04-2008 02:47 AM
Adding printer entry into host file Wade Gava HP-UX 2 03-28-2008 08:04 AM
problem in adding an extra entry in a dir:fuse imlementation Tanvirk Linux 0 01-24-2008 02:40 PM
Adding entry into crontab in ksh program nir_s Shell Programming and Scripting 2 03-31-2005 10:45 AM
Adding a Unix machine to the domain Wize UNIX for Dummies Questions & Answers 3 09-15-2004 02:41 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-26-2006
hcclnoodles hcclnoodles is offline
Registered User
  
 

Join Date: Mar 2002
Posts: 272
adding a host entry on another machine

I have written this small script to add an entry to a remote /etc/hosts file which needs to be run from our central admin box and is passed one parameter $1 <hostname>

Code:
#!/bin/ksh
echo "Which host entry would you like to add to $1"
read host_to_add
echo "what is the IP address?"
read ip

echo "Adding $host_to_add $ip to $1"
ssh $1 'echo $host_to_add $ip >> /etc/hosts'
but obviously this doesnt work because the variables arent passed over when issuing the ssh statement at the end there, so what i actually get in the target machines host file is a blank line at the end

Does anybody have an idea on how I can get around this???

Cheers
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0