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: Zachary Santer
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:02:17 -0500

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 what you want is a parameter expansion that will expand a variable to
its value and then unset the variable, then it can't be used to have a
given variable unset in a simple command's environment. And you can get
what you want with a normal parameter expansion, and then calling unset on
the variable afterwards.

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.


reply via email to

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