Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

This question already has an answer here:

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.

share|improve this question

marked as duplicate by Gilles Nov 26 '14 at 23:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 1 down vote accepted

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 [ ... ].

share|improve this answer
    
Where would that go? How do enable errors like that? –  USERID_UNK Nov 26 '14 at 14:14
    
@USERID_UNK: I see it in the terminal, it goes to the standard error. –  choroba Nov 26 '14 at 14:14
    
is there a link you could suggest for where to learn what the difference between [] and [[]] is in bash? –  USERID_UNK Nov 26 '14 at 14:16
    
@USERID_UNK: man bash of course, maybe also Bash Hackers or Advanced Bash Scripting Guide. –  choroba Nov 26 '14 at 14:19
    
oh for future readers, I found this: stackoverflow.com/questions/3427872/… –  USERID_UNK Nov 26 '14 at 14:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.