Bash // dialog scripting

Create some functions:

 function prepare_dialog () {
    # DIALOG STDOUT
    exec 3>&1
 }

 function d_selectOneGender () {
 C_GEND_LIST="$(getexistinggenders)"
 D_STRG=""
 for C_GEND in $C_GEND_LIST; do
    D_STRG="${D_STRG} $C_GEND Gender OFF $C_GEND"
 done
 dialog \
    --backtitle "$VERSION" \
    --clear \
    --title "$1" \
    --item-help \
    --radiolist 'Select one:' \
    $H $W $MH \
    $D_STRG
 return $?
 }

… and call them:

 prepare_dialog
 GENDER="$(d_selectOneGender "Current Gender" 2>&1 1>&3)" || break

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.