help-bash
[Top][All Lists]
Advanced

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

Re: feature todo .. be able to unset vars at assignment stage , without


From: Greg Wooledge
Subject: Re: feature todo .. be able to unset vars at assignment stage , without unset util , for coding language fair extendment
Date: Fri, 23 Feb 2024 11:58:12 -0500

On Fri, Feb 23, 2024 at 11:02:17AM -0500, Zachary Santer wrote:
> On Fri, Feb 23, 2024 at 8:26 AM alex xmb sw ratchev <fxmbsw7@gmail.com>
> wrote:
> 
> > its gotta work in more complex just unset itself after
> > eg in parameter expansion
> > actually ${~var} to use and unset is quite nice
> > im not sure about more advanced syntax , as in parameter expansion

> If ${~var} actually expands to something, like it looks like it would do,
> what it expands to would be taken as the command to run.
> 
> $ var='word'
> $ PATH='/usr/bin' ${var} printf '%s\n' "Words words words"
> bash: word: command not found...
> 
> If you can't use this thing to have a given variable unset in a simple
> command's environment, it presents no benefit over the unset builtin.

Yeah, I'm not sure about the "use and expand" idea.  I don't see the
benefit of that, and it seems like it would cause confusion.

What I was envisioning was something more like

    DISPLAY=${~} xsomething

or

    http_proxy=${~} wget "$url"

which would invoke the command with one environment variable removed.
You could combine it with other assignments that add env vars, too:

    http_proxy=${~} WGET_ASKPASS="$pass_program" wget "$url"

This may be a stupid example, but I'm only trying to demonstrate the
syntax, not actually propose a beneficial feature here.  Maybe xmb
could give us a more real-world example of what he's aiming for.



reply via email to

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