From: Francois Fleuret Date: Mon, 3 Aug 2020 17:35:21 +0000 (+0200) Subject: Simplified a bit. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;p=xremote.git Simplified a bit. --- 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