1

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

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

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

1

3 Answers 3

7

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

http://linuxcommand.org/

and

http://www.tldp.org/LDP/Bash-Beginners-Guide/html/

1

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

1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .