Linux – Does .bashrc contain syntax errors

bashbashrclinuxUbuntu

In the Ubuntu 18.04 LT .bashrc file there is the following:

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

Isn't xterm-color) an instance of unbalanced parentheses? And why does the line end with two semicolons?

To be clear, this is not something I wrote. It's in the virgin file, not edited by me.

If there are syntax errors, to whom should I report this?

Best Answer

This is the standard, correct syntax for a bash case statement(known abstractly as a switch statement in general programming), albeit perhaps an odd syntax when compared to C, Java, or other languages.

From The Linux Documentation Project:

Nested if statements might be nice, but as soon as you are confronted with a couple of different possible actions to take, they tend to confuse. For the more complex conditionals, use the case syntax:

case EXPRESSION in CASE1) COMMAND-LIST;; CASE2) COMMAND-LIST;; ... CASEN) COMMAND-LIST;; esac
Related Question