Show the example dialogs below:
#!/bin/bash # # dlgs.sh : all dialogs in one script, 1- a radio list, 2- a Yes/No dialog, 3-An input box radiolist_result=$(dialog --stdout --clear --backtitle "Combining dialog w/ expect" \ --radiolist "Select distro:" 10 40 3 1 "CentOS" off 2 "Ubuntu" on 3 "Debian" off) dialog --stdout --clear --title "Simple question" --backtitle "Combining dialog w/ expect" \ --yesno "Are you having fun?" 6 25 && yesno_result=Yes || yesno_result=No inputbox_result=$(dialog --stdout --clear --backtitle "Combining dialog w/ expect" \ --inputbox "Enter your name:" 8 40)
I use CentOS 6 for this demo, but it seems to work on other distros:
$ yum -y install expect
Assign execution permissions to dlgs.sh:
$ chmod +x dlgs.sh
Start recording using autoexpect:
$ autoexpect autoexpect started, file is script.exp
Call dlgs.sh and interact:
$ ./dlgs.sh ... 3 No Eduardo Lago AguilarBy pressing Ctrl+D end the session watch. Then verify the recording by calling the generated script:
$ ./script.exp ... 3 No Eduardo Lago Aguilar
Very simple isn't? See more.
No comments:
Post a Comment