David, I look forward to trying these out. We still write some interactive bash scripts for non-technical users, so I appreciate the options. Greg On Wed, Nov 17, 2010 at 7:22 AM, David C. Rankin <drankinatty@suddenlinkmail.com> wrote:
On 11/17/2010 07:48 AM, David C. Rankin wrote:
"man dialog" gives the details. Just another tool to add to your toolbox...
Just a bit of follow-up. The '--stdout' option allows you to directly assign the user response to a variable for many of the dialog types (menus, radioboxes, select list, etc...) A couple of quick examples you can cut & past to test are:
Menu (returns menu text):
user_select=$(dialog --stdout --title "Most used linux command" \ --menu "Please choose from the following command line tools:" 15 55 5 \ "man" "To read man pages" \ "ls" "To display the contents of a directory" \ "vi" "Text editor" \ "mount" "To mount partitions" \ "su" "Super user permissions")
echo "user_select: $user_select"
RadioBox (returns exclusive index):
cpu=$(dialog --stdout --backtitle "CPU Selection" \ --radiolist "Select CPU type:" 11 40 4 \ 1 i586 off \ 2 i686 on \ 3 x86_64 off \ 4 IA64 off)
echo "cpu: $cpu"
Using an Array to hold select list options (returns all selected):
declare -a mvar
mvar=( $(dialog --stdout --checklist "Choose toppings:" 10 40 3 \ 1 Cheese on \ 2 "Tomato Sauce" on \ 3 Anchovies off) )
for ((i=0;i<${#mvar[@]};i++)); do echo "mvar[$i]: ${mvar[$i]}"; done
I thought they were useful enough to pass along. Enjoy!
-- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-- Greg Freemyer Head of EDD Tape Extraction and Processing team Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer CNN/TruTV Aired Forensic Imaging Demo - http://insession.blogs.cnn.com/2010/03/23/how-computer-evidence-gets-retriev... The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org