help-bash
[Top][All Lists]
Advanced

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

Re: a sentense about set -k .. ?


From: Greg Wooledge
Subject: Re: a sentense about set -k .. ?
Date: Thu, 29 Jun 2023 22:57:40 -0400

On Fri, Jun 30, 2023 at 04:34:08AM +0200, alex xmb ratchev wrote:
>               -k      All arguments in the form of assignment statements are
>                       placed in the environment for a command, not just
> those
>                       that precede the command name.
> 
> its not echo $yo yo=7
> nor yo=7 echo $yo

https://mywiki.wooledge.org/BashFAQ/104

Your example is flawed, as explained on that page.  You need to use a
command that actually *uses* the yo environment variable.

unicorn:~$ awk 'BEGIN {print ENVIRON["yo"]}' yo=7

unicorn:~$ set -k
unicorn:~$ awk 'BEGIN {print ENVIRON["yo"]}' yo=7
7

I've never seen anyone use this set -k "feature".  I cannot see any good
reason for it to continue to exist.  Looks extremely legacy-ish.



reply via email to

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