grab FTP output in bash script
script:
#!/bin/sh HOST='80.172.10.255' USER='ahahahah' PASSWD='eheheheh' ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD put file <--------- i want to grab the command result into a bash variable to hadle it #here quit END_SCRIPT #here exit 0 |
Hi,
This 'solution' will grab all the output the ftp session creates, not only the line specified (put file). So this could not be what you are looking for....... Code:
#!/bin/sh |
You may want to look at using lftp instead... it has a simpler syntax for scripting FTP sessions than the standard ftp client and will produce a lot less output (more relevant output).
output=$(lftp -c "put file" -u$USER,$PASSWD) WilliamsJD |
All times are GMT -5. The time now is 10:16 PM. |