Re: "trap" output from "if" statement redirected wrongly

2022-04-14 Thread Chet Ramey
On 4/13/22 8:58 AM, Frank Heckenbach wrote: Bash Version: 5.1 Patch Level: 16 Release Status: release Description: This script writes "foo" to bar rather than stdout as I'd expect. That's not unreasonable, but it's not how it works. It's triggered by the "if" statement (which doesn't even

Re: "trap" output from "if" statement redirected wrongly

2022-04-14 Thread Andreas Kusalananda Kähäri
On Wed, Apr 13, 2022 at 02:58:30PM +0200, Frank Heckenbach wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat > -Werror=format-security -Wall > uname output:

Building loadable builtin

2022-04-14 Thread Robert E. Griffith
I am developing a loadable builtin and I have a question about building it for distribution. I am currently building it in the "Bash-5.0 patch 17" git commit and it works fine when I run it in the bash executable built from that same commit (5.0.17(4)) but it fails when I run it in the bash fr

Re: Building loadable builtin

2022-04-14 Thread Jesse Hathaway
On Thu, Apr 14, 2022 at 11:52 AM Robert E. Griffith wrote: > Question 3: what is the best practice for maintaining loadable builtins? > Can anyone suggest an existing loadable builtin project that I could > model mine after? I don't have too much advice on best practices, but I did write a blog p

Re: Building loadable builtin

2022-04-14 Thread Robert E. Griffith
Thanks Jesse, that's a great post. I wish I had found it when I started. I wonder why its not higher on a google of "bash loadable builtin". It would have saved me a lot of time figuring out how some of the internals work like creating variables and understanding the global vs in-function state

Re: Building loadable builtin

2022-04-14 Thread Chet Ramey
On 4/14/22 12:52 PM, Robert E. Griffith wrote: I am developing a loadable builtin and I have a question about building it for distribution. I am currently building it in the "Bash-5.0 patch 17" git commit and it works fine when I run it in the bash executable built from that same commit (5.0.

Re: Building loadable builtin

2022-04-14 Thread Chet Ramey
On 4/14/22 1:48 PM, Robert E. Griffith wrote: Are there any resources available for understanding the bash internals more? Only the source code. Is this an appropriate place to ask questions on that or is there better place for that? You can ask on help-bash too, since this isn't really a