help-bash
[Top][All Lists]
Advanced

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

Re: why does </proc/self/environ not work in bash?


From: Zachary Santer
Subject: Re: why does </proc/self/environ not work in bash?
Date: Mon, 12 Feb 2024 12:44:41 -0500

On Mon, Feb 12, 2024 at 10:14 AM Chet Ramey <chet.ramey@case.edu> wrote:

> A system call tracer helps here. You'll find that the shell forks,
> sets up the redirection by opening /proc/self/environ, then execs tr,
> which reads the open file descriptor it inherits through execve.
>

It seems you'd be losing nothing in terms of optimization by evaluating the
word representing the file that's being redirected to or from before the
fork takes place, which would avoid this little bit of weirdness:

On Sun, Feb 11, 2024 at 5:51 PM Lawrence Velázquez <vq@larryv.me> wrote:

>
> https://mywiki.wooledge.org/BashPitfalls#cmd_.3E_.22file.24.28.28i.2B-.2B-.29.29.22


Point 64, there.


reply via email to

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