diff --git a/ussh b/ussh index 4d4d9b1..c4b1513 100755 --- a/ussh +++ b/ussh @@ -132,9 +132,13 @@ function remove_keys() { etitle "Suppression des entrées dans ~/.ssh/known_hosts" for host in "${allhosts[@]}"; do splituserhost "$host" user host - if [ "${host%.}" != "$host" ]; then + if [ "$host" == localhost ]; then + : # ne pas corriger localhost + elif [ "${host%.}" != "$host" ]; then + # si le nom se termine par ., le prendre tel quel host="${host%.}" elif ! [[ "$host" == *.* ]]; then + # sinon rajouter le domaine par défaut le cas échéant host="$host${DOMAIN:+.$DOMAIN}" fi @@ -168,9 +172,13 @@ function do_ssh() { [ "${#hosts[*]}" -gt 1 ] && showtitle=1 || showtitle= for host in "${hosts[@]}"; do splituserhost "$host" user host - if [ "${host%.}" != "$host" ]; then + if [ "$host" == localhost ]; then + : # ne pas corriger localhost + elif [ "${host%.}" != "$host" ]; then + # si le nom se termine par ., le prendre tel quel host="${host%.}" elif ! [[ "$host" == *.* ]]; then + # sinon rajouter le domaine par défaut le cas échéant host="$host${DOMAIN:+.$DOMAIN}" fi