Zenity progress bar and output
Solution 1
Um, no, this is wrong. You assign something to the variable $response
and then pipe this assignment to zenity. Try
process | tee /tmp/response.txt | zenity --progress --pulsate --auto-close
response=$( cat /tmp/response.txt )
That way, the output will be stored in the file /tmp/response.txt
, which you can later read into a variable.
Solution 2
I had the same problem and didn't want to create a temp file, so my solution was:
#!/bin/bash
FIFO=$(mktemp -u)
mkfifo $FIFO
(cat $FIFO | zenity --progress --pulsate --auto-close) &
response=$(process)
echo 'Bye bye' > $FIFO
rm -f $FIFO
Related videos on Youtube
nunzio13n
I am an Italian guy, that is studying electronics engineering. I like of course, all the electronic stuff, Linux and Android. The programming is one of my interest but I think that I have a lot to learn yet!
Updated on September 18, 2022Comments
-
nunzio13n almost 2 years
I wrote this little script:
response=$(process ...) | zenity --progress --pulsate echo $response
I want read the response of the process, whatever it is, and show a pulsating progress bar in the meanwhile. The problem is that I don't read any response at the end. I think because all the output from the previous process is sent to zenity.
-
January almost 11 yearsUm, no, this is wrong. You assign something to the variable
$response
and then pipe this assignment to zenity. -
nunzio13n almost 11 yearsYes, I know was wrong. Unfortunately I didn't know the command "tee"... I'm going to try it now!
-