zsh-users
 help / color / mirror / code / Atom feed
* here document within a switch fails to parse.
@ 2021-01-06 15:13 Ray Andrews
  2021-01-06 16:20 ` Daniel Shahaf
  0 siblings, 1 reply; 22+ messages in thread
From: Ray Andrews @ 2021-01-06 15:13 UTC (permalink / raw)
  To: Zsh Users

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.



^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2021-01-13 23:55 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 15:13 here document within a switch fails to parse Ray Andrews
2021-01-06 16:20 ` Daniel Shahaf
2021-01-06 17:17   ` Ray Andrews
2021-01-06 17:58     ` Lawrence Velázquez
2021-01-06 19:18     ` Bart Schaefer
2021-01-07  7:55       ` Ray Andrews
2021-01-07 15:32         ` Daniel Shahaf
2021-01-07 20:16           ` Ray Andrews
2021-01-08 15:27             ` Karsten Borgwaldt
2021-01-08 15:53               ` Lawrence Velázquez
2021-01-08 17:13                 ` Ray Andrews
2021-01-08 18:06                   ` Peter Stephenson
2021-01-08 19:39                     ` Ray Andrews
2021-01-08 19:56                       ` Bart Schaefer
2021-01-09  0:45                         ` Ray Andrews
2021-01-09 17:28                         ` Ray Andrews
2021-01-12 13:28             ` Daniel Shahaf
2021-01-12 14:45               ` Ray Andrews
2021-01-13 16:17                 ` Daniel Shahaf
2021-01-13 21:57                   ` Pier Paolo Grassi
2021-01-13 23:39                     ` Ray Andrews
2021-01-13 23:54                       ` Lawrence Velázquez

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).