What's wrong with it?
Code: Select all
function ftpdo (){
ftp -inv "$1" "$2" <<"EOF" | while read line; do svgnum $line; export cnt=$((cnt + 1)); done > /tmp/listpipe
user $3 $4
$5
$6
ls
EOF
}
export -f ftpdo
function ftpfn (){
HOST="$(cat /tmp/ftp | cut -f1 -d'|')"
PORT="$(cat /tmp/ftp | cut -f2 -d'|')"
USER="$(cat /tmp/ftp | cut -f3 -d'|')"
PASSWORD="$(cat /tmp/ftp | cut -f4 -d'|')"
EXEC1="$("$1")"
EXEC2="$($2)"
[ ! -f /tmp/FTP ] && yad \
--form \
--field="HOST" "$HOST" \
--field="Port" "$PORT" \
--field="USER:H" "$USER" \
--field="PASSWORD:H" "$PASSWORD" \
--field="EXEC1" "$EXEC1" \
--field="EXEC2" "$EXEC2" \
--field="Do:FBTN" "bash -c \"ftpdo "%1" "%2" "%3" "%4" "%5" "%6" \"" \
--columns=2 > /tmp/ftp
touch /tmp/FTP
case $? in
0) rm -f /tmp/FTP;;
1) rm -f /tmp/FTP
exit;;
esac
}
export -f ftpfn