Re: Exporting functions does not expand aliases in subshells

2024-04-13 Thread Chet Ramey
On 4/11/24 11:51 AM, Robert Elz wrote: For how aliases can mess things up, with the bash way of parsing command substitutions, if we do: foo() { echo hello; X=$(echo goodbye); echo "$X"; } and just run foo then we get "hello", "goodbye" (on successive lines). Let's assume that this

Re: Exporting functions does not expand aliases in subshells

2024-04-11 Thread Kerin Millar
On Thu, 11 Apr 2024, at 4:57 PM, Oğuz wrote: > On Thursday, April 11, 2024, Kerin Millar wrote: > Notwithstanding, I tried declaring the same function in an interactive > instance of dash and found that the alias within the command > substitution does end up being expanded, which is in stark

Re: Exporting functions does not expand aliases in subshells

2024-04-11 Thread Oğuz
On Thursday, April 11, 2024, Kerin Millar wrote: > > Notwithstanding, I tried declaring the same function in an interactive > instance of dash and found that the alias within the command substitution > does end up being expanded, which is in stark contrast to the behaviour of > bash. > Bash's

Re: Exporting functions does not expand aliases in subshells

2024-04-11 Thread Robert Elz
Date:Thu, 11 Apr 2024 15:54:21 +0100 From:"Kerin Millar" Message-ID: <57e307d0-6a16-443b-82ce-adf540f96...@app.fastmail.com> | The behaviour of dash seems more logical to me, | though I am uncertain as to which shell is in the right. In as much as how aliases

Re: Exporting functions does not expand aliases in subshells

2024-04-11 Thread Kerin Millar
On Thu, 11 Apr 2024, at 10:05 AM, Philipp Lengauer wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -g -O2 -flto=auto -ffat-lto-objects -flto=auto > -ffat-lto-objects -fstack-protector-strong

Re: Exporting functions does not expand aliases in subshells

2024-04-11 Thread Robert Elz
Date:Thu, 11 Apr 2024 11:05:43 +0200 From:Philipp Lengauer Message-ID: | When defining aliases and then exporting a function uses these aliases, the | exported function body has the aliases expanded. This makes sense because | we cannot be sure the same

Exporting functions does not expand aliases in subshells

2024-04-11 Thread Philipp Lengauer
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall uname output: Linux TAG009442498805