Tell me more ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

While I understand how to create menus, no guide I've found teaches how to actually link them to commands

I was hoping to have something like:

dialog--clear --title "n00b's spellbook" \
        --menu "Choose thine spell:" 20 51 4 \
        1 "Name of program"  "blah" \
        2 "Name of other program" "blah" \

then somehow 1 runs ./program1 and 2 runs ./program2

share|improve this question

Sorry. Missed the point. Did not catch it was the dialog package – @jasonwryan fix of the markup made it more clear. – So this is a complete re-write.

As noted by the man pages; I recommend you download the source and look in the examples folder.

If you're in apt-get world simply say:

apt-get source dialog
cd dialog*/samples

A basic example from the yes/no sample (with some modifications):

: ${DIALOG=dialog}

: ${DIALOG_YES=0}
: ${DIALOG_NO=1}
: ${DIALOG_ESC=255}


DIALOG_ERROR=254
export DIALOG_ERROR

$DIALOG --title "YES/NO BOX" --clear "$@" \
        --yesno "A simple Yes/No dialog." 15 61

retval=$?

case $retval in
  $DIALOG_YES)
    echo "YES";;
  $DIALOG_NO)
    echo "NO";;
  $DIALOG_ERROR)
    echo "ERROR!";;
  $DIALOG_ESC)
    echo "ESC pressed.";;
esac
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.