ne pas corriger localhost

This commit is contained in:
Jephte CLAIN 2014-05-02 22:54:00 +04:00
parent 8884953459
commit abd197b843
1 changed files with 10 additions and 2 deletions

12
ussh
View File

@ -132,9 +132,13 @@ function remove_keys() {
etitle "Suppression des entrées dans ~/.ssh/known_hosts" etitle "Suppression des entrées dans ~/.ssh/known_hosts"
for host in "${allhosts[@]}"; do for host in "${allhosts[@]}"; do
splituserhost "$host" user host 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%.}" host="${host%.}"
elif ! [[ "$host" == *.* ]]; then elif ! [[ "$host" == *.* ]]; then
# sinon rajouter le domaine par défaut le cas échéant
host="$host${DOMAIN:+.$DOMAIN}" host="$host${DOMAIN:+.$DOMAIN}"
fi fi
@ -168,9 +172,13 @@ function do_ssh() {
[ "${#hosts[*]}" -gt 1 ] && showtitle=1 || showtitle= [ "${#hosts[*]}" -gt 1 ] && showtitle=1 || showtitle=
for host in "${hosts[@]}"; do for host in "${hosts[@]}"; do
splituserhost "$host" user host 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%.}" host="${host%.}"
elif ! [[ "$host" == *.* ]]; then elif ! [[ "$host" == *.* ]]; then
# sinon rajouter le domaine par défaut le cas échéant
host="$host${DOMAIN:+.$DOMAIN}" host="$host${DOMAIN:+.$DOMAIN}"
fi fi