Skip to content

shell

!shell

Category: commands

Run a command through a real shell (default /bin/bash), enabling pipes, redirects, and builtins.

Notes

  • chdir follows the same absolute target-path rules as !command. The directory is entered before invoking the selected shell, inside the sudo context. It is scoped to this command; missing or inaccessible directories fail regardless of failed_when. Plan validates path syntax without entering the directory.

Parameters

NameTypeRequiredDescription
cmdstringyesThe shell command line to execute (templated; passed to -c).
shellstringnoPath to the shell binary (e.g. /bin/zsh). Default /bin/bash.
chdirpathnoAbsolute working directory on the execution target (templated). Omission preserves the target’s default directory.
savestringnoVariable name to save { rc, out, stdout }.
failed_whenconditionnoExpression overriding fail-when-rc-nonzero.
changed_whenconditionnoExpression overriding always-changed.

Examples

- !shell
  cmd: ps aux | wc -l
  save: proc_count