This script is to connect to different servers and copy a file from a loaction defined. It is mandatory to use sftp and not ftp.
#!/usr/bin/ksh -xvf
Detail="jyotibo|snv4915|/tlmusr1/tlm/rt/jyotibo/JyotiBo/ jyotibo|snv4915|/tlmusr1/tlm/rt/jyotibo/JyotiBo/"
password=Unix11!
c_filename=import.log
localpath1=`pwd`
for i in $Detail
do
echo $i
UserName=`echo $i | cut -d'|' -f1`
echo $UserName
remotehost=`echo $i | cut -d'|' -f2`
echo $remotehost
remote_path=`echo $i | cut -d'|' -f3`
echo $remote_path
{
echo "open $remotehost
user $UserName $password
lcd $localpath1
cd $remote_path
bi
prompt
mget $c_filename
prompt
"
} |ftp -i -n -v 2>&1
done
I want to do the similar thing using sftp instead of ftp.