Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
here document within a switch fails to parse.
- X-seq: zsh-users 26335
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: here document within a switch fails to parse.
- Date: Wed, 6 Jan 2021 07:13:45 -0800
- Archived-at: <https://zsh.org/users/26335>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2021-01/db51fbd9-20d4-9a52-1925-1a2c9115771c%40eastlink.ca>
- List-id: <zsh-users.zsh.org>
function test1 ()
{
: <<'ENDCOM' # No problems here with either ending #1 or #2
echo "Bad Idea!" # Some commented code.
ENDCOM # Ending #1: comment-out one line ok.
case ${1} in
n ) echo en ;;
#: <<'ENDCOM' # This pair: "parse error near `\n'"
#ENDCOM
esac
#ENDCOM # Ending #2: comment-out most of function ok.
echo "What's goin' on?"
}
... So it seemed that a case statement won't tolerate a here document
within itself. But then there's this, which parses fine:
function test2 ()
{
case ${1} in
n ) echo en ;;
v )
: <<'ENDCOM' # But this pair works fine.
echo "BAD!" # Some commented code
ENDCOM
echo GOOD!: # Much better.
;;
esac
}
... So what am I missing? Sometimes the here document is perfectly
ignored, other times it creates an error. Looks wrong. So far I haven't
found any comparable errors but this.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author