Running shell script with no environmental variables

It seems you can prefix your script with env -i which will clear the environment before running the script:

env -i sh test.sh

From man env:

-i, --ignore-environment
              start with an empty environment

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. (see man bash search for exec \[-cl\]).