I am using following shell script to ftp files to another server
but this is failing as the shell script changes the user name for the ftp login
the correct user name is 'ag\invprint' which the script is fetching from a file using grep command but the ftp log says the script is trying to logon as user 'aginvprint'
Looks like the script is removing the character '\' when trying to ftp
Can someone please help and let me know how to fix this issue ?
Script is as follows .............
-------------------------------------------------------------------------------------------------------------------
cd /home/DWETL
server=`grep "AG_PS" $XXTNG_TOP/etc/ftp.dat | awk '{print $2}'`
FTP_USERID=`gre p "AG_PS" $XXTNG_TOP/etc/ftp.dat | awk '{print $3}'`
PASSWD=`grep "AG_PS" $XXTNG_TOP/etc/ftp.dat | awk '{print $4}'`
PS_DESTDIR=`gre p "AG_PS" $XXTNG_TOP/etc/ftp.dat | awk '{print $5}'`
dest_path="cd $PS_DESTDIR"
echo "User name .. " $FTP_USERID > ~/AG_Priory_Park. log
echo "Password .. " $PASSWD > ~/AG_Priory_Park. log
`ftp -i -n -v $server <<... >~/AG_Priory_Park. ftp
user $FTP_USERID $PASSWD
ascii
$dest_path
put copy.sch
quit
...`
-------------------------------------------------------------------------------------------------------------------
Output of AG_Priory_Park. ftp is as follows
-------------------------------------------------------------------
Connected to 10.160.200.22.
220 Microsoft FTP Service
331 Password required for 'aginvprint'.
530 User 'aginvprint' cannot log in.
Login failed.
530 Please login with USER and PASS.
530 Please login with USER and PASS.
200 PORT command successful.
530 Please login with USER and PASS.
221
Cheers
Nitin
but this is failing as the shell script changes the user name for the ftp login
the correct user name is 'ag\invprint' which the script is fetching from a file using grep command but the ftp log says the script is trying to logon as user 'aginvprint'
Looks like the script is removing the character '\' when trying to ftp
Can someone please help and let me know how to fix this issue ?
Script is as follows .............
-------------------------------------------------------------------------------------------------------------------
cd /home/DWETL
server=`grep "AG_PS" $XXTNG_TOP/etc/ftp.dat | awk '{print $2}'`
FTP_USERID=`gre p "AG_PS" $XXTNG_TOP/etc/ftp.dat | awk '{print $3}'`
PASSWD=`grep "AG_PS" $XXTNG_TOP/etc/ftp.dat | awk '{print $4}'`
PS_DESTDIR=`gre p "AG_PS" $XXTNG_TOP/etc/ftp.dat | awk '{print $5}'`
dest_path="cd $PS_DESTDIR"
echo "User name .. " $FTP_USERID > ~/AG_Priory_Park. log
echo "Password .. " $PASSWD > ~/AG_Priory_Park. log
`ftp -i -n -v $server <<... >~/AG_Priory_Park. ftp
user $FTP_USERID $PASSWD
ascii
$dest_path
put copy.sch
quit
...`
-------------------------------------------------------------------------------------------------------------------
Output of AG_Priory_Park. ftp is as follows
-------------------------------------------------------------------
Connected to 10.160.200.22.
220 Microsoft FTP Service
331 Password required for 'aginvprint'.
530 User 'aginvprint' cannot log in.
Login failed.
530 Please login with USER and PASS.
530 Please login with USER and PASS.
200 PORT command successful.
530 Please login with USER and PASS.
221
Cheers
Nitin
Comment