A parameterized NSH script, where the parameters are supplied at run time by enumerated values.

Version 2
    Share:|

    # Obtain the list of Name = Value pairs for a Server Property called ADMIN_ACCOUNT
    # and then store the values into an array

    typeset -i VARX=1

    blcli <login profile details> PropertyClass listEnumPropertyValues Class://SystemObject/Server ADMIN_ACCOUNT |
    while read LINE
    do
        set -- ${LINE}    # split the line into parameter values
        if [ $# -eq 3 ]
        then
            VARVALUE[${VARX}]=${3}    # store the value into an array
            (( VARX = VARX + 1 ))   # increment the counter
        fi
    done

    (( COUNT = VARX - 1 ))
    echo "There were ${COUNT} argument values"
    echo " and they are..."

    typeset -i CHKVAR=1

    while (( CHKVAR <= COUNT ))
    do
        echo "${VARVALUE[${CHKVAR}]}"
        (( CHKVAR = CHKVAR + 1 ))
    done