try not process exp in ()

This commit is contained in:
Nguyen Huu Thuong
2020-06-12 03:15:13 +02:00
parent dd6a69179a
commit 52caa45a82
3 changed files with 12 additions and 4 deletions

View File

@@ -32,10 +32,14 @@ executeSSH() {
# evaluate each line against all environment variables
while IFS= read -r LINE; do
LINE=$(echo $LINE)
if [[ -z "${LINE}" ]]; then
continue
fi
COMBINE="&&"
LASTCOMBINE="&&"
LASTCOMBINE=""
if [[ $LINE =~ ^.*\&\&$ ]]; then
LINE="$LINE true"
LASTCOMBINE="&&"
elif [[ $LINE =~ ^\&\&.*$ ]]; then
LINE="true $LINE"
elif [[ $LINE =~ ^.*\|\|$ ]]; then
@@ -46,6 +50,9 @@ executeSSH() {
COMBINE="||"
fi
LINE=$(eval 'echo "$LINE"')
if ! [[ $LINE =~ ^\(.*\)$ ]]; then
LINE=$(eval echo "$LINE")
fi
LINE="$LINE $LASTCOMBINE"
if [ -z "$COMMANDS" ]; then