Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Catching whiptail checklist results in bash script

  1. #11
    Join Date
    May 2007
    Location
    The New Forest
    Beans
    Hidden!
    Distro
    Xubuntu

    Re: Catching whiptail checklist results in bash script

    @sixfootseven - try now please

  2. #12
    Join Date
    Mar 2006
    Location
    Williams Lake
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Catching whiptail checklist results in bash script

    It worked for me, so whatever Elfy did, it worked. I changed it back to unsolved, so the op could do it.

  3. #13
    Join Date
    May 2007
    Location
    The New Forest
    Beans
    Hidden!
    Distro
    Xubuntu

    Re: Catching whiptail checklist results in bash script

    Quote Originally Posted by cariboo907 View Post
    It worked for me, so whatever Elfy did, it worked. I changed it back to unsolved, so the op could do it.
    That'll be why it wouldn't let me unsolve it just now then

    Just want the OP to check so we can be sure it's not just staff.

  4. #14
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: Catching whiptail checklist results in bash script

    Quote Originally Posted by sixfootseven View Post
    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 ...

  5. #15
    Join Date
    Dec 2012
    Beans
    7

    Re: Catching whiptail checklist results in bash script

    Thanks everyone, I appreciate the continued help with whiptail. My little script is getting rather huge. Can't wait to show it off.

    I guess I should learn python and implement the results in there instead at some point!

    I am now able to mark this thread as solved, and have done so.

  6. #16
    Join Date
    May 2007
    Location
    The New Forest
    Beans
    Hidden!
    Distro
    Xubuntu

    Re: Catching whiptail checklist results in bash script

    Excellent - that worked then

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •