[Tcsh] Variable assignment from pipes and redirections

Matheus Garcia tateusg at hotmail.com
Fri May 31 04:34:28 UTC 2024


https://github.com/tcsh-org/tcsh/pull/105
In recognition of Bourne-compatible Shells and Mashey Shell, I came up with an implementation for assigning variables from pipes and redirections. Normal assignment reads until EOF or a newline is found. Indexed assignment reads until EOF. This is implemented for environment variable assignment as well. In order to avoid confusion with manual assignment, assignment from pipes and redirections is only possible if the variable name doesn't precede the assignment operator [equal sign]. This means subsequent names in a single command (e.g: set a b c) will be assigned from a pipe or redirection. If the name precedes the assignment operator, subsequent names, even if preceded or not by the assignment operator, won't read from a pipe or redirection.

This work also provides a fix for pipes, at the cost of having piped built-ins forked. I don't think this cost should be taken badly, since most (if not all) Bourne-compatible Shells fork piped built-ins. The fix remedies the issue regarded here [https://mailman.astron.com/pipermail/tcsh/2023-November/000337.html], on blank output from pipes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.astron.com/pipermail/tcsh/attachments/20240531/b361fc80/attachment.htm>


More information about the Tcsh mailing list