From 59b7f134ba242bbf195fd42a45b6db15dfbe77e1 Mon Sep 17 00:00:00 2001 From: Daniel Thomas Date: Mon, 5 Feb 2024 17:05:50 +0000 Subject: [PATCH] Add escaping to ampersand To resolve problem with multi-command Drone scripts caused by a change in Bash 5.1: > x. New shell option: patsub_replacement. When enabled, a `&' in the replacement > string of the pattern substitution expansion is replaced by the portion of > the string that matched the pattern. Backslash will escape the `&' and > insert a literal `&'. https://tiswww.case.edu/php/chet/bash/NEWS --- command.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command.sh b/command.sh index a29fb64..ee1ddd7 100644 --- a/command.sh +++ b/command.sh @@ -17,7 +17,7 @@ if [[ "${PLUGIN_CMD:-}" == "" ]]; then fi # If multiple cmd lines have been provided, chain them into something which we can execute with sh # Note that Drone provides these lines in comma separated form without escaping, which means commas in commands are known to break -export PLUGIN_CMD=${PLUGIN_CMD//,/ && } +export PLUGIN_CMD=${PLUGIN_CMD//,/ \&\& } # Wrap command scriptlet in an invocation of sh export PLUGIN_CMD="sh -c '${PLUGIN_CMD}'"