[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why does </proc/self/environ not work in bash?
From: |
Greg Wooledge |
Subject: |
Re: why does </proc/self/environ not work in bash? |
Date: |
Sun, 11 Feb 2024 18:13:23 -0500 |
On Sun, Feb 11, 2024 at 11:57:31PM +0100, Christoph Anton Mitterer wrote:
> What I basically do is, making a check, whether the current /bin/sh
> would export any variables in its own environment, that are not valid
> shell names, into executed utilities.
OK, then simply do that.
env - GOOD=valid B+A-D=invalid PATH="$PATH" sh -c env | grep valid
Here's what I get on Debian 12 (with sh -> dash):
unicorn:~$ env - GOOD=valid B+A-D=invalid PATH="$PATH" sh -c env | grep valid
GOOD=valid
unicorn:~$ env - GOOD=valid B+A-D=invalid PATH="$PATH" bash -c env | grep valid
B+A-D=invalid
GOOD=valid
There's no need for /proc shenanigans here.
- Re: why does </proc/self/environ not work in bash?, (continued)
Re: why does </proc/self/environ not work in bash?, Lawrence Velázquez, 2024/02/11
Re: why does </proc/self/environ not work in bash?, Kerin Millar, 2024/02/11
Re: why does </proc/self/environ not work in bash?, Christoph Anton Mitterer, 2024/02/11
Re: why does </proc/self/environ not work in bash?, Christoph Anton Mitterer, 2024/02/11
Re: why does </proc/self/environ not work in bash?, Chet Ramey, 2024/02/12
Re: why does </proc/self/environ not work in bash?, Christoph Anton Mitterer, 2024/02/12
Re: why does </proc/self/environ not work in bash?, Lawrence Velázquez, 2024/02/12
Re: why does </proc/self/environ not work in bash?, Chet Ramey, 2024/02/13
Re: why does </proc/self/environ not work in bash?, Chet Ramey, 2024/02/13
Re: why does </proc/self/environ not work in bash?, Kerin Millar, 2024/02/11