What does the meaning of ;; in this code from ~/bashrc file?

case $- in
    *i*) ;;
      *) return;;

Can I use ;; in other ways? and where?


3 Answers 3


From man bash:

          If the ;; operator is used, no subsequent matches are
          attempted after the first pattern match.  Using ;& in  place  of
          ;;  causes  execution  to continue with the list associated with
          the next set of patterns.  Using ;;& in place of ;;  causes  the
          shell  to  test  the next pattern list in the statement, if any,
          and execute any associated list on a successful match.

So no, you can't use ";;" elsewhere, it's case-specific syntax in bash scripts. As for the meaning, if you finish each case item with ;;, it will stop after executing the code for the first match. If you use ;& instead, it will execute the first match, then continue looking for other matches, so you could perform multiple match actions.

For additional information see





That is the end of a single item in your case-switch,
see e.g.: bash-case-statement


The double semicolon indicates the end of the case branch. See help case command for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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