As I know, newly running shell script inherits it's environment variables. Is there a way to block this? (running shell without variable inheriting)
As I know, newly running shell script inherits it's environment variables. Is there a way to block this? (running shell without variable inheriting)
It seems you can prefix your script with
env -i
which will clear the environment before running the script:From
man env
:Not sure why you would want to do this though...
One possibility (although it looks rather ugly):
exec -c $SCRIPT
will start $SCRIPT with an empty environment. (seeman bash
search forexec \[-cl\]
).