commit 154d5a857f1ca7b1cf4a8a82e8e1837889bbfbce parent 471b9c5cdf70b57ccc6d15a775b0747c56f5f60f Author: Antoine Amarilli <a3nm@a3nm.net> Date: Fri, 9 Dec 2016 15:46:01 +0100 +runon Diffstat:
runon | | | 18 | ++++++++++++++++++ |
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/runon b/runon @@ -0,0 +1,18 @@ +#!/bin/bash + +# run command on $1, ssh'ing if necessary + +MACHINE=$(echo "$1" | cut -d'.' -f1) +HOST=$(hostname | cut -d'.' -f1) +shift +# http://superuser.com/a/403369/77814 +quoted_args="$(printf " %q" "$@")" + +if [ $MACHINE = $HOST ] +then + exec zsh -ic "$quoted_args" +else + exec ssh -q -t $MACHINE zsh -ic \"$quoted_args\" +fi + +