Artificial intelligent assistant

How do I write a bash script to report machine states and conditionally ping them? #!/usr/bin/bash array1=( HPUX2 HPUX3 ) array2=( `cat $HOME/testo |awk '{print $2}'` ) The file testo,report HPUX2 OFF HPUX3 ON I want my script to report "Machine HPUX2 is OFF" and machine HPUX3 is ON, if a machine is ON then the script should `ping` that machine. Does someone know how to do this? Thanks

What I would do :


for i in "${array[@]}"; do
ping -c1 "$i" &>/dev/null && echo "$i ON" || echo "$i OFF"
done

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 69009fd0edd1cf8bf9bdcab6134b76e8