PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs323] Follow up: last line
Date: Wednesday, 30 Sep 2020, 06:54:54


    > Message Posted By: Unknown
    >
    > When I run
    > % echo -n 'a << b\nc\na' | parsley
    >
    > It gives me:
    >
    > (1)$ CMD (Depth = 0):  SIMPLE,  argv[0] = a   STDIN << HERE
    >          HERE:
    > So, I don't think the input lines are terminated by 'b'. I tried this:
    >
    > $ echo -n 'a << b\nc\nb' | /c/cs323/Hwk2/parsley
    >
    > It gives me the same results. I am not sure why

SHORT ANSWER: Try

  % echo -n -e 'a << b\nc\na' | parsley

instead.

LONG ANSWER:  For some shells (e.g., tcsh) the echo
command is a built-in command that is executed by the
shell itself.  For others (e.g., bash) it is executed by
running /bin/echo, which behaves slightly differently.

The echo command built into tcsh (which is the shell that
I use) does not require the -e flag to give the results I
wanted; /bin/echo does.

--Stan-
PREV INDEX NEXT