Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Can some one correct this script

$
0
0
Hi,
I tried writing a script and there was a problem with SFTP part
can some one correct where is is the mistake

Enveronment file
Code:

#!/bin/bash
export HOST_NAME=<>
export USER_NAME=<>
export PASSWORD=<>
export SOURCE_PATH=/u03/informatica/current/server/infa_shared/TgtFiles/mfg
export LOCATION_PATH=/u03/informatica/current/server/infa_shared/TgtFiles/mfg
export LOGFILE_DIR=/u03/informatica/current/server/infa_shared/TgtFiles/mfg

Main Script is
Code:

#!/bin/bash
#########################
#MAIL SCRIPT
#########################

. /u03/informatica/.informatica.env
. /u03/informatica/current/server/infa_shared/ScriptFiles/mfg/oa3/CSSS_Etct_File_Tns.env

cd $SOURCE_PATH
echo '$SOURCE_PATH'

for i in DEES-* ; do
s=`echo $i | cut -d "-" -f3`
echo $s
result=$(grep -h $s $SOURCE_PATH/csss_file*.txt)
dest_path=`echo $result | cut -d "|" -f2`

echo $dest_path

sftp $Host_name << end_script
user $User_name $Password
cd $dest_path
put $source_path/*$s*
quit
end_script

done
exit 0

when i am trying to run this is not going for SFTP and also i need to pass password as parameter

can some one help in correcting me need to delver it in a day

Thanks
Deepu

Viewing all articles
Browse latest Browse all 16232

Trending Articles