From dde3613f83fa39a17e1a09e98766b380a999dda2 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Mon, 3 Aug 2020 19:35:21 +0200 Subject: [PATCH] Simplified a bit. --- xremote.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/xremote.sh b/xremote.sh index 478a773..bcb33ca 100755 --- a/xremote.sh +++ b/xremote.sh @@ -70,7 +70,8 @@ xremote.sh [--help] [-h ] [-d ] [-r ] main executable and post-run commands are ignored If the -r option is provided, the result files specified with - @XREMOTE_GET will be downloaded there. + @XREMOTE_GET will be downloaded there instead of the current + directory. If no argument is provided to @XREMOTE_HOST, and the -h option is not specified, the environment variable \$XREMOTE_HOST is used @@ -170,8 +171,8 @@ do if [[ "${line}" =~ '@XREMOTE' ]] then - label=$(echo "${line}" | sed -e 's/^.*@XREMOTE_\([^:]*\):.*$/\1/') - value=$(echo "${line}" | sed -e 's/^.*@XREMOTE_[^:]*: *\(.*\)$/\1/') + label=$(sed -e 's/^.*@XREMOTE_\([^:]*\):.*$/\1/' <<<"${line}") + value=$(sed -e 's/^.*@XREMOTE_[^:]*: *\(.*\)$/\1/' <<<"${line}") case "${label}" in @@ -260,12 +261,14 @@ else RESULT_DIR="." fi +[[ "${ARG_RESULT_DIR}" ]] && mkdir -p "${ARG_RESULT_DIR}" + while read line do if [[ "${line}" =~ '@XREMOTE' ]] then - label=$(echo "${line}" | sed -e 's/^.*@XREMOTE_\([^:]*\):.*$/\1/') - value=$(echo "${line}" | sed -e 's/^.*@XREMOTE_[^:]*: *\(.*\)$/\1/') + label=$(sed -e 's/^.*@XREMOTE_\([^:]*\):.*$/\1/' <<<"${line}") + value=$(sed -e 's/^.*@XREMOTE_[^:]*: *\(.*\)$/\1/' <<<"${line}") case "${label}" in POST) check_remote_is_defined -- 2.39.5