When using a bash for loop and ssh'ing to multiple machines the hostname variable is not updated to be the name of the machine I've ssh'd into.
What am I missing here?
"A", "B", "C" are replaced with names of actual machines and the speech marks removed in the actual execution.
for node in "A" "B" "C" ;
do
ssh $node "echo $node $HOSTNAME is alive" ;
done
In the example above $node is correctly outputted but $HOSTNAME is the name of the machine which I SSH from.