Sponsored Content
Full Discussion: Can someone please help!
Top Forums Shell Programming and Scripting Can someone please help! Post 302216117 by nua7 on Friday 18th of July 2008 03:21:59 AM
Old 07-18-2008
I have to take user input till user enters "done" , so I used the while loop.I have added the if line code after the read statement.


Also , I need to have a different count of all three arrays , so kept different variables.

I know I kept on bugging you for small queries , but this script simply won;t work!

I just need to pick up hostnames, usernames and passwords from the user and put some files/folder onto the hosts.

Can anyone give me a script that would work. (I know this is too much of asking...)

Here's the modofied version:

Code:
#!/usr/bin/sh
##Take input from the user
c=d=e=0
while [ "$host_name" != done ] 
do
  echo "Please enter the host_name"
  read host_name
  if [ "$host_name" = done ] ; then break; fi
  store_hostname[$c]=$host_name
  c=$(( c + 1 ))
  echo "Please enter the username"
  read username
  echo $username
  store_username[$d]=$username
  d=$(( d + 1 ))
  echo "Please enter the password"
  read password
  echo $password
  store_password[$e]=$password
  e=$(( e + 1 ))
done

len= size of array
for i in $len
do
#Create a destination directory
ssh -q ${store_username[$d]}@${store_host_name[$c]} mkdir temp
#scp files to host
scp -r /root/temp ${store_username[$c]}@${store_host_name[$c]}:/root/
done

 
Graphics::Primitive::Insets(3pm)			User Contributed Perl Documentation			  Graphics::Primitive::Insets(3pm)

NAME
Graphics::Primitive::Insets - Space between things DESCRIPTION
Graphics::Primitive::Insets represents the amount of space that surrounds something. This object can be used to represent either padding or margins (in the CSS sense, one being inside the bounding box, the other being outside) SYNOPSIS
use Graphics::Primitive::Insets; my $insets = Graphics::Primitive::Insets->new({ top => 5, bottom => 5, left => 5, right => 5 }); METHODS
Constructor new Creates a new Graphics::Primitive::Insets. Instance Methods as_array Return these insets as an array in the form of top, right, bottom and left. bottom Set/Get the inset from the bottom. equal_to Determine if these Insets are equal to another. left Set/Get the inset from the left. right Set/Get the inset from the right. top Set/Get the inset from the top. zero Sets all the insets (top, left, bottom, right) to 0. AUTHOR
Cory Watson, "<gphat@cpan.org>" SEE ALSO
perl(1) COPYRIGHT &; LICENSE Copyright 2008-2010 by Cory G Watson. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2010-08-21 Graphics::Primitive::Insets(3pm)
All times are GMT -4. The time now is 01:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy