Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

here document within a switch fails to parse.



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