I have finally written this code, but the prob with this is that when it is prompting for password it doesnt send any password to the ftp machine, we have to do it manually, but after typing it manually, it take the password line as command and shows that that is invalid command.
please tell me a way to pass the password automatically
Shell Scripting Syntax (Toggle Plain Text)
CONFIG_FILE="${HOME}/c/config.cfg"
Password=`awk '$1 ~ /password/ { print $3 }' $CONFIG_FILE`
echo $Password
if [ ! -r $CONFIG_FILE ]
then
echo "File not readable";exit0;
fi
ftp -i `awk '$1 ~ /server_IP/ { print $3 }' $CONFIG_FILE` <<END
`awk '$1 ~ /user/ { print $3 }' $CONFIG_FILE`
`awk '$1 ~ /password/ { print $3 }' $CONFIG_FILE`
`awk '$1 ~ /file_mode/ { print $3 }' $CONFIG_FILE`
cd `awk '$1 ~ /file_path/ { print $3 }' $CONFIG_FILE`
get `awk '$1 ~ /file_name/ { print $3 }' $CONFIG_FILE`
quit
END
the config file is as
(Toggle Plain Text)
server_IP = 10.18.14.2
user = scpyogesh
password = scpyogesh
file_mode = binary
file_path = sample/test/
file_name = test_ftp.txt