Compound statement: subshell or command group.
Examples
# (cd /tmp && ls) - subshell
%Compound{
kind: :subshell,
statements: [...]
}
# { cd /tmp && ls; } - group (current shell)
%Compound{
kind: :group,
statements: [...]
}
# cmd1; cmd2; cmd3 - sequential
%Compound{
statements: [
%Command{name: "cmd1", ...},
%Command{name: "cmd2", ...}
]
}
# cmd1 && cmd2 || cmd3 - operand
%Compound{
statements: [
%Command{name: "cmd1", ...},
{:operator, :&&}
%Command{name: "cmd2", ...},
{:operator, :||}
%Command{name: "cmd3", ...}
]
}
# cmd1 & cmd2 & - operand
%Compound{
statements: [
%Command{name: "cmd1", ...},
{:operator, :bg},
%Command{name: "cmd2", ...},
{:operator, :bg}
]
}
Summary
Types
@type kind() :: :subshell | :group | :operand | :sequential
@type t() :: %Bash.AST.Compound{ exit_code: 0..255 | nil, kind: kind(), meta: Bash.AST.Meta.t(), redirects: [Redirect.t()], state_updates: map(), statements: [Statement.t()] }