mainThe GNU Bourne-Again SHell - Support: sr #110795, Bash Loadable Builtin and...


sr #110795: Bash Loadable Builtin and execute_shell_function

Submitter:  None
Submitted:  Sun 04 Dec 2022 07:32:45 PM UTC
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Need Info
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup

Wed 07 Dec 2022 02:08:58 PM UTC, comment #1: 

You might have better luck posting this to the help-bash mailing list.

Chet Ramey <chet>
Group administrator
Sun 04 Dec 2022 07:32:45 PM UTC, original submission:  

Dear bash friends!

Do you have an idea how to pass stdin and stdout redirections to execute_shell_function?

I also tried to pass a custom COMMAND with custom REDIRECT to execute_command, but unfortunately I am unable to read nor write to shell function.

Basically I did something like:

COMMAND *cmd = make_bare_simple_command ();
cmd->value.Simple->words = make_word_list(make_bare_word("my_function"), get_my_args_list());

source.dest = STDIN_FILENO;
redir.filename = make_word(my_pipe_name);

cmd->value.Simple->redirects = make_redirection (source, r_input_direction, redir, 0);

struct fd_bitmap *bitmap = new_fd_bitmap (FD_BITMAP_DEFAULT_SIZE);

execute_command_internal(cmd, 0, NO_PIPE, NO_PIPE, bitmap);

My function looks like:

function my_function () { cat; }

But as I try to write to $my_pipe_name from another shell, nothing is read by cat.

Kind regards




(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-12-07 chet StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code