what exactly env command do? [duplicate]

env sets one or more environment variables and then runs the remaining arguments as a command.

It’s not significantly different from the following syntax:

x='() { :;}; echo vulnerable' bash -c "echo this is a test"

One thing env can do (although the feature is not used in the above example) is create a clean environment; if the first option to env is a single - (or -i), then the environment is cleaned before doing the explicit assignments and running the command.

Leave a Comment