0

I have a bash script I'm working on to help with an installer. why doesn't this work?

function fn_myFunc(){
        local MYVAR=0
        until ["$MYVAR" -ne 0]; do
                whiptail --yesno "Yes or No?" --no-button "No" --yes-button "Yes" 10 70
                MYVAR=$?
                echo $MYVAR
        done
}

This code loops infinitely, even though if Yes is selected, the echo $MYVAR prints out 0 and it prints 1 if no is selected.

slm
  • 369,824

1 Answers1

1

It should also report

-bash: [: missing `]'

or

-bash: [0: command not found

Insert whitespace where needed. In bash, [[ ... ]] conditions are generally easier to use than [ ... ].

choroba
  • 47,233