# Bash Run Task

Bash Run task enables running local command in a subprocess.

# Example Usage

# File: hello-id.hcl
flow "hello-id" {
  task "bash_run" "id" {
    command = "xxd -l16 -ps /dev/urandom"
  }
}

# Optional Environment Variables

Command task supports optional environment variables through argument env.

# File: hello-id-env.hcl
flow "hello-id-env" {
  task "bash_run" "id" {
    command = "xxd -l $LENGTH -ps /dev/urandom"
    env = {
      LENGTH = "16"
    }
  }
}

Whenever possible, instead of templating variables in the command, pass variables into the command using env. (Bash is quite tricky in some circumstances).

# Argument Reference

The following arguments are supported:

  • command - (Required, str) The command string.
  • env - (Optional, map) The environment variables.

# Attributes Reference

The following attributes are supported:

  • stdout - String. The output of command run.
  • stderr - String. The error of command run.
  • returncode - Int. The exit code of command run.