Skip to content

Commit

Permalink
first attempt at implementing #19
Browse files Browse the repository at this point in the history
  • Loading branch information
reidsunderland committed Oct 21, 2024
1 parent 358c8c1 commit 9ec3a3e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bin/sr3_ssh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,20 @@ if [ -e "${ssh_user_config}" ] && { [ -z "${SSH_AUTH_SOCK}" ] || [ -z "${SSH_AGE
unset_ssh_agent=true
fi

# numerical host, issue #19
if [[ "$1" == "-n"* ]] ; then
machine_list="${git_tld}/_dsh_config/${pump_name}.list"
if [ ! -e "${machine_list}" ]; then
echo "[ERROR] dsh machine list does not exist (${machine_list})."
exit 4
fi
hostname="$(head ${1} ${machine_list} | tail -n1)"
echo "Host ${1} --> ${hostname}"
shift
fi

# shellcheck disable=SC2086,SC2029
ssh ${ssh_args} "$@"
ssh ${ssh_args} ${hostname} "$@"

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

0 comments on commit 9ec3a3e

Please sign in to comment.