Skip to content

Instantly share code, notes, and snippets.

@benwei benwei/test-cases.sh
Last active Mar 14, 2019

Embed
What would you like to do?
run remote cases by ssh with multiple arguments using shell - https://ben6.blogspot.com/2019/03/run-command-with-multiple-arguments.html
#/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
You can’t perform that action at this time.