ByteChef LogoByteChef

Bash

Runs arbitrary Bash scripts on the server. Deprecated: use the Script component's Bash action.

Categories:

Type: bash/v1


Actions

Execute

Name: execute

Creates a temporary script that executes bash commands. The script is afterwards deleted. Deprecated: use the Bash action of the Script component instead.

Properties

NameLabelTypeDescriptionRequired
scriptScriptSTRINGScript written in bash. Multiple commands are possible with the ';' separator.true

Example JSON Structure

{
  "label" : "Execute",
  "name" : "execute",
  "parameters" : {
    "script" : ""
  },
  "type" : "bash/v1/execute"
}

Output

Sample Output:

Sample result

Type: STRING


Additional Instructions

Deprecated

The Bash component is deprecated. Use the Bash action of the Script component instead, and see Migrating from the Bash component for a step-by-step move. Workflows that already use the Bash component keep running, and its Execute action is labelled as deprecated in the workflow editor.

How Execute Runs

Execute writes the script to a temporary file, makes it executable and runs it directly on the ByteChef server, as the server's OS user:

  • the script sees the server process's whole environment, including its datasource password and cloud credentials;
  • it runs in the server's working directory, with the server's files in reach;
  • it has no timeout;
  • it is not governed by any task runner setting, so an operator cannot switch it off with bytechef.script.runners.*.

The action returns the script's output as a single string.

What The Script Bash Action Changes

Bash componentScript Bash action
Task typebash/v1/executescript/v1/bash
Runs onThe server, alwaysThe Process, Docker, Kubernetes or AWS Batch runner the operator enabled
EnvironmentThe server'sCleared; Input values as INPUT_<name>, Environment, and the BYTECHEF_* variables
FilesThe server's working directoryA fresh working directory, with Input Files and Output Files
TimeoutNoneTimeout, 5 minutes by default on the Process runner
ConnectionsNoneDelivered in connections.json and masked in the output
ResultThe output, as a stringexitCode, stdout, stderr, vars and outputFiles; a non-zero exit fails the task

A step that read ${listFiles} reads ${listFiles.stdout} after the move:

{
  "name": "listFiles",
  "type": "script/v1/bash",
  "parameters": {
    "script": "set -euo pipefail\n\nls -la",
    "taskRunner": {"type": "process"}
  }
}

The Bash action needs a runner the operator enabled, for example bytechef.script.runners.process.enabled=true. See Task Runners.

How is this guide?

Last updated on

On this page