为单个命令取消设置的环境变量

问题描述:

在bash中,您可以通过设置环境变量单个命令

In bash, you can set an environmental variable for a single command using

FOO=bar somecommand

如果你想的取消设置的单个命令变量?

从技术上讲,他们没有环境变量,直到有人导出取值他们。但你至少可以将其设置为空:

Technically, they're not environment variables until someone exports them. But you can at least set them to empty:

FOO= some command

如果从环境中删除它们就足够了,你可以使用 ENV

If removing them from the environment is enough, you can use env:

env -u FOO somecommand