シェルスクリプト

Doller sign の意味

  • $1, $2, $3, ... are the positional parameters.
  • "$@" is an array-like construct of all positional parameters, {$1, $2, $3 ...}.
  • "$*" is the IFS expansion of all positional parameters, $1 $2 $3 ....
  • $# is the number of positional parameters.
  • $- current options set for the shell.
  • $$ pid of the current shell (not subshell).
  • $_ most recent parameter (or the abs path of the command to start the current shell immediately after startup).
  • $IFS is the (input) field separator.
  • $? is the most recent foreground pipeline exit status.
  • $! is the PID of the most recent background command.
  • $0 is the name of the shell or shell script.

コロンの意味

  • :は何もしないコマンド。
  • 使いみちは、正常終了させたい時に使う(set -eと併用など)
  • set -eはnon zeroなコードが返った場合は終了するので

boolean

WAIT_FOR_IT=false

if "${WAIT_FOR_IT}"; then
  echo "TRUE!!!"
fi

REF

  • https://stackoverflow.com/questions/5163144/what-are-the-special-dollar-sign-shell-variables