Sh plugin¶
Description¶
The sh plugin is used for executing commands in the sh shell, rather than executing the command right away. This is very useful for executing command lines that need special shell characters like &&
, |
, ;
, >
.
Mandatory settings¶
Mandatory settings for all modes¶
-
command
Command to execute in the shell, as a string. See the
-c
option ofsh
for more information.
Optional settings¶
The configuration of the sh plugin may contain the following additional settings:
-
command-line
Additional command line parameters to pass as a list of separate arguments. By default no additional arguments are added.
-
patterns
A list of patterns to apply on the command line. See Patterns (5).
-
enviroment
A list of environment variables that should be set before the commands are executed. See Environment (5).
-
command-line
Additional command line parameters to pass as a list of separate arguments. By default no additional arguments are added.
-
working-dir
The working directory of the command. Can be an absolute path are a relative one w.r.t. the path to the considered configuration file. Commands that should be executed relative to the current working dir can use the
{EH_WORKING_DIR}
pattern.
Example¶
Configuration¶
commands: # Define the commands that can be run
example: run the sh example
patterns: # Define the patterns that can be used
EXAMPLE_PATTERN: # Define the EXAMPLE_PATTERN.
default-values: # Define the default value
- world!
example:
- sh # Use the sh plugin when running the 'example' command
sh: # Sh plugin configuration settings
example: # Settings specific to the 'example' command
environment: # Define the environment
EXAMPLE_ENVIRONMENT: hello
patterns: # Define the patterns that are used
- EXAMPLE_PATTERN
command: 'echo ${EXAMPLE_ENVIRONMENT} && echo {EXAMPLE_PATTERN} && echo "working directory is $(pwd)"' # Define the shell command
command-line: [ -ex] # Pass additional command line arguments
working-dir: /tmp # Set the working directory to a predefined value
Usage¶
Save the example to an exec-helper configuration file and execute in the same directory:
eh example
See also¶
See exec-helper (1) for information about the usage of exec-helper.
See Configuration (5) for information about the configuration file format.
See Plugins (5) for information about the configuration file format.