I'm trying to port this code from wget + zenity
to wget + kdialog
.
The code with zenity
:
#!/bin/bash
# Start wget | zenity
# Note the & at the end of the pipe, this allows the script to continue with wget running in the background
wget http://www.zezeniaonline.com/download/downloadlinux 2>&1 | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | zenity --progress --title="Downloading File..."
#Start a loop testing if zenity is running, and if not kill wget
RUNNING=0
while [ $RUNNING -eq 0 ]
do
if [ -z "$(pidof zenity)" ]
then
pkill wget
RUNNING=1
fi
done
The Zenity Code Works perfectly
I need to do the same but with kdialog
. I'm tried first with the follow code:
#!/bin/bash
# Start wget | kdialog
wget http://www.zezeniaonline.com/download/downloadlinux 2>&1 | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | kdialog --progressbar " " --title="Downloading File..."
#Start a loop testing if zenity is running, and if not kill wget
RUNNING=0
while [ $RUNNING -eq 0 ]
do
if [ -z "$(pidof kdialog)" ]
then
pkill wget
RUNNING=1
fi
done
that don't work at all
#!/bin/bash
# Start wget | kdialog
wget --progress=dot http://www.zezeniaonline.com/download/downloadlinux 2>&1 | fgrep --line-buffered '%' \ | sed -u -r 's:.* ([0-9]+)% .*:\1:' | kdialog --title "Installation" --progressbar " " &
#Start a loop testing if kdialog is running, and if not kill wget
RUNNING=0
while [ $RUNNING -eq 0 ]
do
if [ -z "$(pidof kdialog)" ]
then
pkill wget
RUNNING=1
fi
done
But the follow errors. Yes its downloading, but the "progress" are not "progressing" in the "kdialog"