Multi-line YML commands
The YML syntax supports steps that have multiple lines. Just start the step with "- |"
and indent it 2 columns further. See example from here: How can I start and stop a background task on travis?
- |
# This is a comment in the multi-line block
if [ "$TEST_ADAPTER" = "HTTP" ]; then
vendor/bin/httpd.php&
SERVER_PID=$!
# Blank lines are also supported
fi
Call a bash script from YML
You can also call an external shell script from the YML file. This script can contain multiple lines:
- chmod +x my_script.sh # Make the script executable, if necessary
- ./my_script.sh # Run the external script
- bash ./my_script.sh # Run the external script
Wrap long lines in shell scripts or YML commands
Both YML and shell scripts support wrapping long lines with the backslash "\"
character at the end of the line. They are called bash continuation lines, and described here Bash continuation lines . Here's an example:
printf '%s' \
"This will all be printed on a " \
"single line (because the format string " \
"doesn't specify any newline)"