On 1/11/19 5:27 AM, Joerg Schilling wrote:
> Stephane Chazelas <stephane.chaze...@gmail.com> wrote:
> 
>> alias for=pour
>> alias do=faire
>> alias to_french='echo '
>>
>> for word in for do; do
>>   eval "to_french $word"
>> done
>>
>> (which already doesn't work in bash except in posix mode nor in
>> zsh in posix mode or not).
> 
> From looking at the error message from bash. it seems that the reason why 
> bash 
> fails here is that it parses scripts as a whole and thus does not expand 
> aliases inside scripts at all.

The latter is true by default; the former is not. You can enable alias
expansion in non-interactive shells with an option.

> If you check the same in an interactive bash 5, you even get error messages 
> that lead to an implementation bug.

There's no bug. Bash allows reserved words to be alias expanded when not in
posix mode.

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

Reply via email to