Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 6310  / 2 Years ago, sun, december 5, 2021, 7:15:38

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.


More From » bash

 Answers
3

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.


[#30450] Sunday, December 5, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ovierman

Total Points: 445
Total Questions: 108
Total Answers: 111

Location: Libya
Member since Fri, Oct 30, 2020
4 Years ago
;