Command Substitution - Definição do Glossário de CI/CD
Command substitution substitui $(command) (ou backticks) pela saída daquele comando, permitindo capturar resultados em uma variável ou argumento, por exemplo VERSION=$(cat VERSION).
No CI
A command substitution roda em um subshell e remove as quebras de linha finais, o que é útil para capturar um git SHA: SHA=$(git rev-parse --short HEAD). Se o comando interno falhar, a variável apenas recebe uma saída vazia, a menos que set -e e o tratamento de erros a capturem.
Guias relacionados
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…