Skip to content

Commit 9ec3a3e

Browse files
first attempt at implementing #19
1 parent 358c8c1 commit 9ec3a3e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

bin/sr3_ssh

+13-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,20 @@ if [ -e "${ssh_user_config}" ] && { [ -z "${SSH_AUTH_SOCK}" ] || [ -z "${SSH_AGE
3030
unset_ssh_agent=true
3131
fi
3232

33+
# numerical host, issue #19
34+
if [[ "$1" == "-n"* ]] ; then
35+
machine_list="${git_tld}/_dsh_config/${pump_name}.list"
36+
if [ ! -e "${machine_list}" ]; then
37+
echo "[ERROR] dsh machine list does not exist (${machine_list})."
38+
exit 4
39+
fi
40+
hostname="$(head ${1} ${machine_list} | tail -n1)"
41+
echo "Host ${1} --> ${hostname}"
42+
shift
43+
fi
44+
3345
# shellcheck disable=SC2086,SC2029
34-
ssh ${ssh_args} "$@"
46+
ssh ${ssh_args} ${hostname} "$@"
3547

3648
# Clean up ssh-agent
3749
if [ "${unset_ssh_agent}" = "true" ] && [ -n "${SSH_AGENT_PID}" ]; then

0 commit comments

Comments
 (0)