LoginSignup
0
1

More than 5 years have passed since last update.

Bashの変数展開

Posted at

mongod の起動スクリプトに以下の記述があった。

/etc/init.d/mongod
mongod=${MONGOD-/usr/bin/mongod}

空欄か未定義だと - 以降が展開される?
正式な仕様を探したら man bash の "Parameter Expansion" に以下の記載があった。

  Omitting the colon results in a test  only  for  a  parameter  that  is
  unset.

":" コロンが省略された場合、未定義の場合のみ ${parameter:-word} と同じ挙動になるようだ。

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