#!/usr/bin/env bash subcommand() { local ssh="$(config app.ssh)" if [[ ! -d "$BASHTARD_ETCDIR/hosts.d" ]] then crit "$BASHTARD_NAME/ssh" "Could not find hosts file at $BASHTARD_ETCDIR/hosts.d" return 3 fi chgdir "$BASHTARD_ETCDIR/hosts.d" for node in * do local user local host local ip user="$(config_for "$node" "ssh.user" "root")" # Try IPv6 first host="$(config_for "$node" "ssh.host" "$(config_for "$node" "vpn.ipv6")")" if [[ -z "$host" ]] then # Otherwise try IPv4 host="$(config_for "$node" "ssh.host" "$(config_for "$node" "vpn.ipv4")")" fi notice "ssh" "$user@$node ($host) > $*" $ssh "$user@$host" "$@" unset user unset host done }