[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bash-bug
Subject:    Re: bash command alias has a problem in using brace.
From:       Chet Ramey <chet.ramey () case ! edu>
Date:       2021-08-31 15:20:44
Message-ID: 818d27cc-cc1f-aaf3-e6c7-69ff0d8da50c () case ! edu
[Download RAW message or body]

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/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic