Subshell - Definição do Glossário de CI/CD
Um subshell é um process de shell filho criado ao envolver comandos em ( ... ), por um pipeline ou por command substitution. Mudanças de variável dentro dele não afetam o shell pai.
No CI
Uma surpresa frequente: cmd | while read line; do VAR=$line; done define VAR em um subshell, então VAR fica vazia depois. Como cada estágio de um pipe roda em seu próprio subshell, o estado definido ali é perdido quando o pipeline termina.
Guias relacionados
Shell - CI/CD Glossary DefinitionShell: A shell is the command interpreter that reads commands, expands variables and globs, and launches proc…
Pipe - CI/CD Glossary DefinitionPipe: A pipe (`|`) connects the standard output of one command to the standard input of the next, letting sma…
Command Substitution - CI/CD Glossary DefinitionCommand Substitution: Command substitution replaces `$(command)` (or backticks) with that command output, let…