bug-bash
[Top][All Lists]
Advanced

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

Re: Building loadable builtin


From: Robert E. Griffith
Subject: Re: Building loadable builtin
Date: Thu, 14 Apr 2022 13:48:55 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

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 states.

Are there any resources available for understanding the bash internals more?

Is this an appropriate place to ask questions on that or is there better place for that?

Currently I am trying to figure out how to properly create a nameref var.  I specified the att_nameref attribute to make_local_variable but when I examine the variable back in the script it is a simple variable and not a nameref. I see specific functions in variables.h for creating arrays but not one for namerefs.

   in builtin..
        // local -n this="$oid"
        SHELL_VAR* this=make_local_variable("this",att_nameref);
        this = bind_variable_value(this, pObj->vThis->name, 0);
   ..then in script...
        declare -p this
   ..output..
        declare -- this="myObj"


--BobG

On 4/14/22 12:59, Jesse Hathaway wrote:
On Thu, Apr 14, 2022 at 11:52 AM Robert E. Griffith<bobg@junga.com>  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 post
on writing builtins, along with some sample code, which you may find
helpful.

post:https://mbuki-mvuki.org/posts/2021-07-12-writing-a-bash-builtin-in-c-to-parse-ini-configs/
code:https://github.com/lollipopman/bash-ini-builtin-blog-post



reply via email to

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