I with to monitor if my access points pingable and store results into 0-1 string
I wrote a script but it works wrong
#/bin/bash
access_points=("tplink2" "redmi1")
#results=("A")
declare -a results
for val in "${access_points[@]}"
do
ping -c 4 -w 10 $val 2>&1 >/dev/null
if [ $? -eq 0 ]
then
online="+"
else
online="-"
fi
results[${#results[@]}]=$online
done
echo "${resutls[*]}"
echo $results
Why? Can I collect values not into arrays but into space separated strings?
!missing in the shebang.