ゆるふわキャンパー
  • Home
  • Search posts
  • About Lorentzca
  • Blog Metrics
Subscribe

sh

A collection of 1 post
Use bash parameter
shell

Use bash parameter

bash parameterなるものを教えてもらったので試してみる 変数のデフォルト値を決められて、もし環境変数とかで指定されていればそれを使ってくれるらしい! $ man sh ... ${parameter:-word} Use Default Values. If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted. ... 実験用にこんなスクリプトを用意 #!/bin/sh echo ${MY_PARAMETER:-'is default parameter'} 実行 $ ./param.sh is default parameter MY_PARAMETERに値をセットしてみる $ export MY_PARAMETER=
Mar 3, 2016 — 1 min read
ゆるふわキャンパー © 2023
Powered by Ghost