Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

variable_string_from_command

Define a variable from a command output.

⚙️ Compatible targets: Linux, Windows

Parameters

NameDocumentation
prefixThe prefix of the variable name.

This parameter must match ^[a-zA-Z_]+$.
This parameter is required.
nameThe variable to define, the full name will be prefix.name.

This parameter must match ^[a-zA-Z_]+$.
This parameter is required.
commandThe command to execute.

This parameter is required.

Outcome conditions

You need to replace ${name} with its actual canonified value.

  • ✅ Ok: variable_string_from_command_${name}_ok
    • ☑️ Already compliant: variable_string_from_command_${name}_kept
    • 🟨 Repaired: variable_string_from_command_${name}_repaired
  • ❌ Error: variable_string_from_command_${name}_error

Example

method: variable_string_from_command
params:
  prefix: VALUE
  command: VALUE
  name: VALUE

Documentation

Define a variable from a command output. The method will execute a shell command and define a variable ${prefix.name} from it.

  • Only stdout is kept
  • The variable will only be defined if the exit code of the command is 0
  • If the variable definition is successful, the method will report a success, it will report an error otherwise.
  • The command will be executed even in Audit mode