Hi,
I'm tryin to write a script that will collect information about a remote servers, put them into variables and print them to screen.
# /usr/bin/bash
ls $1 > /dev/null 2>/dev/null
if [ "$?" -eq 0 ]
then
echo "$1 is file"
for server in $(cat $1)
do
# echo $server
ssh -T $server /bin/bash -s <<EOF
HOST1=$(hostname) #1
`hostname` #2
EOF
echo $HOST1
done
else
echo "$1 is not file"
#ssh $1
fi
the output of the 1st variable is nothing,
and the output of the command is the name of the local machine.
thanks a lot.