shell script dialog box question

view story

http://www.linuxquestions.org – I am able to display a dialog box using following code : Code: dialog --clear  --help-button --backtitle "Linux Shell Script Dialog Box" --title "[ M A I N - M E N U ]" --menu "Here is the description of the menu\nSelect option" 15 50 4 first "define first function" second "Define second" Third "Define third" Exit "Exit" It is displayed successfully, now I want to write functionality for ok & cancel button. How should I do this? If I select first option, select OK and press return key, it should run the define f (HowTos)