D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] standard error handling

 

Hi


I am trying to write a shell script in whiptail ( this is a graphical
toolkit for bash)

whiptail --title "Check list example" --checklist \
"Choose user's permissions" 20 40 4 \
"Hello" "Print Hello" OFF \
"Goodbye" "Print Goodbye" OFF \
"CYA" "Print cya" OFF \

CHOICEs=$?

echo $CHOICEs

    if $CHOICEs = "Hello" ; then
        echo "you selected hello"
    elif $CHOICEs = "Goodbye" ; then
        echo "You Said Good bye"
    elif i$CHOICES = "CYA" ; then
        echo "You said cya"
    fi

This produces a small menu with check boxes (so the first part works), 
I can select what I want and press Ok.

I am not really sure how do handle the output and the 2nd part of this
script doesn't work as expected.  But I don't fully understand stderr
which is the how whiptail outputs to the console / terminal.

Using the information at (
https://en.wikibooks.org/wiki/Bash_Shell_Scripting/Whiptail#Check_list i

This just tells me how to handle the graphical part of this.   Not how
to handle what is produced.

Clearly the example above is meant to echo to the screen something
relating to the options selected,  however as echo can be replaced with
other commands I am just keen to get this working on a very basic level
before I try and do something a little more complex.

Can anyone help please.

thanks

Paul

-- 
Paul Sutton
http://www.zleap.net
gnupg : 7D6D B682 F351 8D08 1893  1E16 F086 5537 D066 302D

https://fediverse.party/ - zleap@xxxxxxxxxxxxxxx


-- 
The Mailing List for the Devon & Cornwall LUG
https://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq