4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

`env HOGE=FOO echo $HOGE` ← 何も出ない

4
Last updated at Posted at 2017-10-06

NG

$ env HOGE=FOO echo $HOGE

出力: (空文字)

$ HOGE=FOO echo $HOGE

出力: (空文字)

OK

$ HOGE=FOO; echo $HOGE

出力: FOO

ただしシェル変数 HOGE に代入されるため副作用がある。

$ HOGE=FOO bash -c 'echo $HOGE'

出力: FOO

こちらは副作用なし。

参考

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?