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
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s