News for hackers. Stuff that matters.
Re:No Ghosts by eithed on Friday December 02, 2022 @05:37AM (#33828831)
From my understanding, explicitness of passing and usage - if your application for example logs all env variables `FOO=bar myapp` would log `FOO=bar XYZ=asd`, but `myapp --foo=bar` would log only `foo=bar`

If two applications are setting FOO, then it results in undesired behaviour: 1. myapp1 runs, FOO=bar 2. myapp2 runs, FOO=xyz 3. myapp1 tries to use FOO, gets xyz

Instead 1. myapp1 --foo=bar runs 2. myapp2 --foo=xyz runs 3. myapp uses foo, gets bar

Re:No Ghosts by jakewins on Friday December 02, 2022 @06:55AM (#33829346)
In my example I set the env var on the same line as the command, so the env var is only set in the new process, per open group:

> If the command name is not a special built-in utility or function, the variable assignments shall be exported for the execution environment of the command and shall not affect the current execution environment

Eg

FOO=bar myapp

FOO=xyz myapp

echo $FOO # prints empty string/newline

Re:No Ghosts by bkfunk on Friday December 02, 2022 @09:40AM (#33830981)
The issue is, can myapp know that it was set that way, vs being set somewhere else? The command line argument uses syntactical constraints to ensure that the value of the argument was set specifically with the intention of using it in myapp.