I want to run a complex script via ssh
#!/bin/sh
ARRAY1=(
server1s
server123
server12
server14
server13
)
for i in ${ARRAY1[@]};do ssh $i "
case \$HOSTNAME in
server1.domain.com)
echo try1
;;
server12.domain.com)
echo try12
;;
*)
echo try123
;;
esac
The problem is ssh read my internal hostname variable and return try123,is possible to read the internal variable of remote site? I have tried \$VARIABLE and $VARIABLE but result is the same