# Run Script

Action `terminal`

`action.script`

Execute a shell script with full access to the incoming payload. All payload variables are exposed as environment variables prefixed with `PAYLOAD_`. For example, a payload key `fileName` becomes `$PAYLOAD_fileName` in your script.

The script runs in the selected shell interpreter. Standard output is captured as the `output` variable and the process exit code is available for downstream branching.

Destructive action

This node executes arbitrary shell scripts with the user's privileges. Watchflows surfaces an inline warning when the script body contains canonical destructive patterns (rm, dd, sudo, mkfs, shutdown, fork bomb), but the heuristic is informational only — it does not block execution. Workflows containing a Script node prompt for confirmation on every arm if the configured script triggers the heuristic.

## Ports

Direction | Name | Data Type | Description
--- | --- | --- | ---
Input | Input | Any | Incoming payload exposed as environment variables
Output | Output | String | Script stdout
Output | Exit Code | Number | Process exit code (0 = success)

## Configuration

Field | Type | Default | Description
--- | --- | --- | ---
shell | Dropdown | `/bin/bash` | Shell interpreter: `/bin/bash`, `/bin/zsh`, or `/usr/bin/python3`
script | Code Editor | — | The script to execute. Access payload via `$PAYLOAD_*` env vars.

## Output Variables

Variable | Type | Description
--- | --- | ---
output | String | Script stdout output
exitCode | Number | Process exit code

## Example

Run a shell script when a webhook fires and show the result as a notification: