diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2020-06-01 22:14:26 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2020-06-01 22:14:26 +0200 |
commit | a1f34001696c44139b668918ea52c1add0dde7ea (patch) | |
tree | af4ea86dfe4ac5a696e3c9eb43935ab9ebb063d4 /tools/rexec.sh | |
parent | f33ea96125c63e112cbef97de3b8376a38681e40 (diff) | |
download | ltask-a1f34001696c44139b668918ea52c1add0dde7ea.tar.gz |
fixed include system, updated some tasks
Diffstat (limited to 'tools/rexec.sh')
-rwxr-xr-x | tools/rexec.sh | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/tools/rexec.sh b/tools/rexec.sh index 98652c4..558540c 100755 --- a/tools/rexec.sh +++ b/tools/rexec.sh @@ -30,7 +30,7 @@ SSH="ssh $SSH_OPTIONS" SCRIPT_FILES=() SCRIPT_INTERPRETER=/bin/sh -FILES="" +FILES=() function parse_args() { for (( i=0; i < $ARGC;i++ )); do @@ -53,7 +53,7 @@ function parse_args() { SSH_IDENTITY=${ARGV[$i]};; -f) i=$((i+1)) - FILES="${ARGV[$i]}";; + FILES+=(${ARGV[$i]});; -h) print_help 0;; *) @@ -85,11 +85,7 @@ EOF parse_args -#[ ! -f $SCRIPT_FILE ] && echo \"$SCRIPT_FILE\" not found && exit 1 +[ ${#FILES[@]} -gt 0 ] && scp $SSH_OPTIONS -i $SSH_IDENTITY -P $SSH_PORT ${FILES[@]} $SSH_HOST: -#INTERPRETER_STRING=$(head -n 1 $SCRIPT_FILE) -#INTERPRETER_REGEX="^#!.*" -#[[ $INTERPRETER_STRING =~ $INTERPRETER_REGEX ]] && SCRIPT_INTERPRETER=$(tail -c +3 <<< $INTERPRETER_STRING) - -[ ! -z "$FILES" ] && scp -S "$SSH" -i $SSH_IDENTITY -P $SSH_PORT $FILES $SSH_HOST: cat ${SCRIPT_FILES[@]} | $SSH -p $SSH_PORT -i $SSH_IDENTITY $SSH_HOST "/bin/bash" +exit $? |