Skip to main content

Shell Script

icon
Shell Script (.sh)

Allows you to execute a shell (.sh) script in a Unix-like environment.

Code

The code of the shell script to execute. Variables can be used in this script and will be replaced before executing

# This is a template shell script

# Replace {file.FullName} and {file.Orig.FullName} with actual values
WorkingFile="{file.FullName}"
OriginalFile="{file.Orig.FullName}"

# Example commands using the variables
echo "Working on file: $WorkingFile"
echo "Original file location: $OriginalFile"

# Add your actual shell commands below
# Example: Copy the working file to a backup location
# cp "$WorkingFile" "/path/to/backup/$(basename \"$WorkingFile\")"

# Set the exit code to
exit 1

Set Working File

You can update the file that will be used by the next flow element in your flow by using SetWorkingFile() in your shell script.

# Rename the working file
NewFile="${WorkingFile%.mp4}_compressed.mp4"
mv "$WorkingFile" "$NewFile"

# Tell the flow to use the new file
SetWorkingFile "$NewFile"
  • No need to manually echo "SETWORKINGFILE=...".
  • Only the last call to SetWorkingFile() in the script will be applied.
  • This allows you to rename, move, or otherwise modify files while ensuring downstream flow elements use the correct file.

Exit Codes

NumberDescription
1+Specifies which output is to be called. Define the number of outputs using the Outputs field. This will add more output connections to the flow element.
0Completes the flow successfully. This will immediately stop the flow and mark it as successful.
otherIf a number is returned that is outside the range of defined outputs, this will mark the flow as unsuccessful.