bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash command alias has a problem in using brace.


From: Chet Ramey
Subject: Re: bash command alias has a problem in using brace.
Date: Tue, 31 Aug 2021 11:20:44 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 8/27/21 9:47 PM, Dale R. Worley wrote:
Hyunho Cho <mug896@gmail.com> writes:

but if i use alias then '>' prompt does not appear and default bash
prompt appears

bash$ alias myalias='{ cat <<\@ > foo ;} 2> /dev/null'
bash$ myalias
bash$ 111
bash$ 222              # bash$ prompt
bash$ @



I don't know the details, but it must have something to do with what
event triggers the reading of the here-document.  That event isn't the
execution of the command containing it, I don't think, but more like
when the here-document-redirection is parsed.

This is substantially correct. When the parser goes and collects the body
of the here-document, it's still parsing the contents of the alias.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]