PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs323] here doc response got cutoff
Date: Sunday, 27 Sep 2020, 19:38:36


    > Message Posted By: Unknown
    >
    > Could you repost your response for "here doc". It got cutoff.

Sorry, I fixed the newsgroup version.
=====

    > Message Posted By: Unknown
    >
    > in the following "<< a << b", the solution code tries to get << a to work
    > first and then fails with "parsley: two input redirects.", whereas mine
    > fails immediately after seeing << a and << b. Do we need to make our code
    > also first do a here document for << a, and then fail?
    >
    > Example I ran "<< a << b". I immediately wrote an "a" when prompted and then
    > got an error.

bash does not flag this as an error since it allows
multiple redirections of stdin.

Here are two ways to handle HERE documents:

1. Read the lines when the << HERE is encountered, in
   which case the first document will be read before the
   second << HERE is encountered and the error is detected.

2. Read the lines when the CMD struct containing the
   HERE document is added to the CMD tree, in which case
   the error is detected before the first document is
   read.

Hwk2/parsley does the first, but the second is just as
reasonable.  Thus the correct behavior (in terms of
whether the document is or is not read) is unspecified
and will not be tested.

--Stan-
PREV INDEX NEXT