commit dafb5b037f350815f9187013688f44d6a0f573ff parent d9176ad6628263858dad41d2bb73fc30fbdfece0 Author: hhvn <dev@haydenvh.com> Date: Sat, 20 Mar 2021 15:41:30 +0000 .s/b/finger: clean up Diffstat:
M | .scripts/bin/finger | | | 13 | +++++-------- |
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/.scripts/bin/finger b/.scripts/bin/finger @@ -22,17 +22,14 @@ # tries to ssh into machine if port 79 is not exposed user=${1%%@*} -host=${1#*@} +hostport="${1#*@}" +host=${hostport%:*} +echo "$host" | grep ':' >/dev/null && port=${hostport##*:} ( - [ -z $host ] && { - printf "$user\r\n" | nc 127.0.0.1 79 - exit - } - [ -z $user ] && { - printf "\r\n" | nc $host 79 || ssh $host finger + printf "\r\n" | nc ${host:-localhost} ${port:-79} } || { - printf "$user\r\n" | nc $host 79 || ssh $host finger $user + printf "$user\r\n" | nc ${host:-localhost} ${port:-79} } ) | tr -d '\r'