![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Need help with Expect and Shell script | tonan | Shell Programming and Scripting | 1 | 04-10-2008 11:45 PM |
| There’sA Linux Distro for Every User -- And Vice Versa - InformationWeek | iBot | UNIX and Linux RSS News | 0 | 07-16-2007 05:30 PM |
| Using expect script in a shell script | Naresh Kumar | Shell Programming and Scripting | 3 | 06-10-2006 09:54 AM |
| binary to string conversion and vice versa | kinnaree | High Level Programming | 3 | 11-16-2002 09:02 AM |
| QNX host cannot ping SCO host, vice versa | gavon | IP Networking | 2 | 08-20-2001 09:57 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Using expect script in a shell script or vice versa
Hi All,
Has anyone used expect script in a shell script or vice versa. I have a script which would ssh and scp to other machines. I need to use expect script so that user does not have to enter the password everytime ssh/scp command is executed. The script is as below. I need to pass the store_password[$i] , store_hostname[$i] to the expect script. 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
# store_username[$d]=$username
# d=$(( d + 1 ))
echo "Please enter the password"
read password
store_password[$e]=$password
e=$(( e + 1 ))
done
echo ${store_hostname[0]}
len=${#store_hostname[*]}
echo $len
for (( i=0; $i < $len; i++ ))
do
#ssh -q root@${store_hostname[$i]} mkdir temp
scp -r /root/temp root@${store_hostname[$i]}:/root/
ssh -q root@${store_hostname[$i]} /root/temp/temp1.sh
done
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|