Command Substitution - CI/CD用語集の定義
command substitution は $(command)(またはバックティック)をそのコマンドの出力に置き換え、結果を変数や引数に取り込めるようにします。例えば VERSION=$(cat VERSION) のように使います。
CI での扱い
command substitution は subshell で実行され末尾の改行を取り除くため、git SHA の取得に便利です: SHA=$(git rev-parse --short HEAD)。内部のコマンドが失敗しても、set -e とエラー処理で捕捉しない限り、変数には空の出力が入るだけです。
関連ガイド
Subshell - CI/CD Glossary DefinitionSubshell: A subshell is a child shell process created by wrapping commands in `( ... )`, by a pipeline, or by…
Shell - CI/CD Glossary DefinitionShell: A shell is the command interpreter that reads commands, expands variables and globs, and launches proc…
Environment Variable - CI/CD Glossary DefinitionEnvironment Variable: An environment variable is a named value held in a process environment and inherited by…