> Fajar Priyanto wrote: > Dear All, > Can we make menu in bash script just like in DOS' batch file? > Such as: > ======= > [Menu] > Pls select what you want to do: > 1. Copy /etc/dhcpd.conf > 2. Copy /etc/wvdial.conf > 3. Make directory /var/log/nullmailer > 4. Do all of above > ====== > Could you please give me some examples?
Besides the case operator that someone else has mentioned, you can also use the "dialog" utility to create menu boxes. For example: dialog --clear --backtitle "A Checkbox" --title "Choose one:" \ --menu "Please select one item:\n" 30 30 8 \ "Item1" "Choose me" \ "Item2" "No, choose me" \ "Item3" "Better choose me" The selection will be sent to stderr which you can either capture to a file or read directly. You'll still need the case operator or nested ifs to act on the user choice. Dialog will also do text input, checkbox, radiobox, etc.. If dialog is cumbersome but you do like the interactivity, take a look at the "newt" package. It has some very easy ways of generating similar menus. -- The Digital Hermit Unix and Linux Solutions http://www.digitalhermit.com [EMAIL PROTECTED]
Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com