Last active
March 14, 2019 16:38
-
-
Save benwei/70b0f532adaa75aef1be3dec7abfc975 to your computer and use it in GitHub Desktop.
run remote cases by ssh with multiple arguments using shell - https://ben6.blogspot.com/2019/03/run-command-with-multiple-arguments.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
# 2019 Ben Wei <ben@juluos.org> | |
# | |
# This is a example script for CI tests for blog | |
# if not defined in environment variable | |
# you can use the following command to defined it | |
# | |
# export TEST_SSH_HOST="your_ssh_host" | |
# | |
function run_cases() | |
{ | |
local case_name="$1" | |
local args="" | |
while [ ! "x$1" = "x" ]; do | |
printf -v __ %q "$1" | |
args="$args \"$__\"" | |
shift | |
done | |
if [ "x${TEST_SSH_HOST}" = "x" ]; then | |
TEST_SSH_HOST=test-server | |
fi | |
ssh ${TEST_SSH_HOST} "cd test-cases; /bin/bash ./tests.sh $args" | |
return $? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment