Originally Posted by
sixfootseven
I tweaked a little to suit my needs, and heres the working sample code:
This method creates a temp file (results). Don't forget to delete it.
The basic method of dealing with temp files is something like:
Code:
...
tempfile=$(mktemp)
trap 'rm -f "$tempfile"' EXIT
whiptail ... 2> "$tempfile"
while read -r line
do
...
done < "$tempfile"
...
But, in this case there is no need for a temp file. You can pipe directly the stderr of whiptail to the while loop.
Code:
whiptail ... 2>&1 | while read -r choice ...
Bookmarks