0
1

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 1 year has passed since last update.

Bash | 環境変数を大文字で書くのは慣習に過ぎない

Last updated at Posted at 2016-08-01

小文字でも環境変数に出来る。

snake.sh
export snake_case='shaaaa!!!!!!!'

printenv snake_case # => shaaaa!!!!!!!

逆に大文字でも、普通の変数にできる。

upper.sh
UPPERCASE='KNOCK DOWN!!!'

echo $UPPERCASE # => KNOCK DOWN!!!
printenv UPPERCASE # => 出力なし

でもなるべく

  • 定数は大文字
  • 変数は小文字

で書くようにしよう。

環境

  • bash 3.2

参考

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?