#!/bin/bash echo -n "Add meg a jelszavad a(z) $USER felhasznalohoz: " read -s PASSWORD echo INPUT_FILE=$1 red=$'\e[1;31m' grn=$'\e[1;32m' yel=$'\e[1;33m' blu=$'\e[1;34m' mag=$'\e[1;35m' cyn=$'\e[1;36m' whi=$'\e[1;37m' inv=$'\e[7;37m' gry=$'\e[1;90m' end=$'\e[0m' nor=$'\e[0m' grep -v '^#' $INPUT_FILE | while read HOST; do printf "Kulcs masolasa: ${USER}@${HOST}..." expect ./lnx_copy_ssh_id.exp $HOST $USER $PASSWORD > /dev/null if [[ $? -eq 0 ]]; then printf "${grn}OK${nor}" else printf "${red}HIBA${nor}" fi printf ", Teszt kapcsolodas..." HOST2=$(ssh -n -o ConnectTimeout=5 $HOST hostname) if [[ $? -eq 0 && "${HOST%%\.*}" == "${HOST2%%\.*}" ]]; then echo "${grn}OK${nor}" else [[ "${HOST%%\.*}" == "${HOST2%%\.*}" ]] && echo echo "${red}HIBA - nem sikerult kapcsolodni{nor}" || echo "${red}HIBA - $HOST <> $HOST2${nor}" fi done