I have read the linux command env manual, specifically, for the -i option, the manual says:
-i, --ignore-environment # start with an empty environment
What I get is that when -i option is specified, the environment is empty,i.e, no environment variable is there, so the command env -i ls should print something like command not found , but what I see is the command executes successfully. So please explain, do I misunderstand anything?
The environment refers to all of the shell variables you set in your .bashrc and .bash_profile on login. If you're compiling something, you may set the
CFLAGSvariable. If you've got something installed in a weird directory, you may do anexport PATH=$PATH:$HOME/build/binto allow it to run without specifying its full path.env -iclears all these user-set variables and gives you a blank environment, so you can, for example, test how a command works if you have none of these extra variables set.