Hello,
Could you please help me to solve below issue? I have created pseudocode which will download files from ftp and will show the progress of the transfer.
The code below works but the issue is that it will show the progress of the bar at first and then it will download all files (...) Is it possible to pipe the "downld" function into the "echo" function somehow?
I did try several things but it failed or ended in the same result
Code:
cd $HOME/test/"$dir"
dwnld () {
ftp -in <<+
open $ftp $port
user $user $pwd
cd $fdir
mget *.txt
bye
+
}
count=$(
ftp -in <<+
open $ftp $port
user $user $pwd
cd $fdir
ls
bye
+
)
result=$(echo "$count" | grep -v "user|ls|^d|bye" | wc -l)
for (( i=0; i<=$result; i++ ))
do
echo "$(( (i * 100) /$result ))"
dwnld
sleep 0.1
done | zenity --progress --title="Copy $result files" --percentage=0 --auto-close