Register
It is currently Sat Dec 20, 2014 4:39 am

SCP Script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPosted: Mon Dec 21, 2009 1:43 am   

Joined: Mon Dec 21, 2009 1:38 am
Posts: 2
Hey all! I'm new to the forum (as you can see by the post count). I'm looking into getting into some bash scripting, and I'm looking for a few examples. I need to make a bash script that SCPs ~/.ssh to another machine also at ~/.ssh. I want to be prompted for port, username, and IP if possible.

Overall:

Script that executes: "scp -P <port> -r ~/.ssh/ <user>@<IP>:\${HOME}/.ssh/
Script should prompt for each variable.

Thanks in advance for the help!

Coheed


Top
 Profile  
 PostPosted: Mon Dec 21, 2009 2:58 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 579
do you want to be asked to set 'port, username, and IP' variables, use read builtin
Code:
for variable in port username IP
  do read -ep "Enter $variable: " $variable
done
echo "$port $username $IP"

or to print those data after scp command is done, which (it seems to me) is not possible, unless you set variables before?


Top
 Profile  
 PostPosted: Mon Dec 21, 2009 11:17 pm   

Joined: Mon Dec 21, 2009 1:38 am
Posts: 2
I believe I'm looking for the former.

Thanks!

~Coheed


Top
 Profile  
 PostPosted: Thu Dec 24, 2009 7:00 pm   

Joined: Thu Oct 16, 2008 3:05 pm
Posts: 13
Have you looked at "ssh-copy-id"?!?!


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP