in reply to Set env variables as part of a command
not sure if that's what you want, but you don't need a subshell to have temporary environment variables (at least in bash)
lanx@lanx-1005HA:~$ echo $a,$b 0,0 lanx@lanx-1005HA:~$ a=666 b=42 perl -e 'print "@ENV{a,b}\n"' 666 42 lanx@lanx-1005HA:~$ echo $a,$b 0,0
please note the "missing" semicolon!
and the vars don't seem to show up in the process list, though I'm no expert there
lanx@lanx-1005HA:~$ ps -edaf |grep perl lanx 2731 2174 0 18:02 pts/2 00:00:00 perl -e print "@ENV{a, +b}\n";sleep 100
Anyway they'll be in the bash history.
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Set env variables as part of a command
by afoken (Chancellor) on Feb 18, 2017 at 18:30 UTC |