Bourne | Ash |  #!  | find | ARG_MAX | Shells | whatshell | portability | permissions | UUOC | ancient | - | ../Various | HOME
"$@" | echo/printf | set -e | test | tty defs | tty chars | $() vs ) | IFS | using siginfo | nanosleep | line charset | locale


# Example A.1
echo $(
      case x in  x) echo A.1;; esac
)

# Example A.2:
echo $(
      case x in  x) echo A.2;; esac # comment
)

# Example A.3:
echo $(
      case x in (x) echo A.3;; esac
)

# Example A.4:
echo $(
      case x in (x) echo A.4;; esac # comment
)

# Example A.5:
echo $(
      case x in (x) echo A.5
      esac
)

# Example B:
echo $(
      echo 'B: quoted )'
)
# Example C
echo $(
      echo C: comment followed by closing parenthesis # )
)

# Example D.1
echo $(
    cat <<\eof
    D.1: here-doc with )
eof
)

# Example D.2
echo $(
    cat <<\eof
    D.3: here-doc with \()
eof
)

# Example D.3 # should fail with unterminated here-doc
echo $(
    cat <<\eof
    D.2: here-doc with )
eof)

# Example D.4
# the first EOF has a trailing blank
# the third EOF is the correct one
echo $(cat <<'EOF'
    D.4 error-prone use of here-doc terminator
EOF 
EOF)
EOF
)
echo after here-document

# Example E
echo $(
    cat <<\)
    E: here-doc terminated with a parenthesis ("academic")
)
)
# Example F
echo $(
    cat <<\eof
    F: here-doc embedded with unbalanced single, back- or doublequote '
eof
)
# Example G
echo $(
    echo G: backslash at end of line # \
)

# Example H
echo H: empty command-substitution $( )