Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Troubleshooting a error output at the end of a script.


# We now request that the user restarts their server...
read -e -p "Restart your server now to complete the install (y/n)? " rsn
    case $rsn in
        [Yy]* ) break;;
        [Nn]* ) exit;


/dev/fd/63: line 446: break: only meaningful in a `for', `while', or `until' loop
/dev/fd/63: line 449: syntax error near unexpected token `done'
/dev/fd/63: line 449: `done'

Any ideas on an alternate to break;; in this instance?

share|improve this question
up vote 2 down vote accepted

Do nothing :) That is, either use for example true or : instead of break or remove the line altogether.

A better solution would be to actually use a while loop:

while true
    [your code]

This way the break does what you want, and you fix a bug: What happens if rsn doesn't start with [YyNn]?

share|improve this answer
Thanks! Great explanation of the subject. Tossed while true; do in there and everything runs smooth. – d3c0y Mar 6 '14 at 8:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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