Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Bashでは、この作業は次のとおりです。
FOO=foo BAR=bar a_command
しかし、それを機能させる方法は?
ENV="FOO=foo BAR=bar" $ENV a_command
私が得た:
FOO=foo: command not found
これが役立つかどうかを確認します。
sh -c "$ENV a_command"
これがenvコマンドの目的です
env
env $ENV a_command
表示される動作はマニュアルに記載されていることに注意してください。シェルは変数を展開する前に変数の割り当てを探します。