Rename and improve range ssh functions

This commit is contained in:
2024-10-04 16:21:54 +02:00
parent d7857f2385
commit e0aa301737

View File

@@ -16,20 +16,31 @@ alias grep='grep --color=auto'
alias weather='curl -H "Accept-Language: en" http://wttr.in/Lausanne' alias weather='curl -H "Accept-Language: en" http://wttr.in/Lausanne'
function dias() { function _ssh_wrap() {
n=$1 if [ ! $# -gt 1 ]
shift then
ssh diascld$n.iccluster.epfl.ch -A -Y $@ echo "Usage: ${0} remote_host [ssh arguments] command"
return
fi
local n="${1}"; shift
ssh ${n} -A -Y "$@"
} }
function diasrange() { function ssh_range() {
start=$1 if [ ! $# -gt 3 ]
end=$2 then
shift; shift; echo "Usage: ${0} remote_prefix start end [ssh arguments] command"
return
fi
local prefix="${1}"; shift
local start="${1}"; shift
local end="${1}"; shift
for d in $(seq ${start} ${end}) for d in $(seq ${start} ${end})
do do
echo diascld$d local remote="${prefix}${d}"
dias $d -x "$@" echo "${remote}"
echo ------------------------------------------------------------------------------ _ssh_wrap "${remote}" -x "$@"
echo "------------------------------------------------------------------------------"
done done
} }