in my bash script , I used the following syntax in order to test the ssh connection test
IP=12.3.4.55
sshpass -p secret123 /usr/bin/ssh -n -o ConnectTimeout=100 -o StrictHostKeyChecking=no -xaq -q root@$IP exit
[[ $? -eq 0 ]] && echo ssh test is ok || echo ssh test is fail
but I want to do it with a & ( so all ssh line will run ss process )
so I did this
IP=12.3.4.55
sshpass -p secret123 /usr/bin/ssh -n -o ConnectTimeout=100 -o StrictHostKeyChecking=no -xaq -q root@$IP exit &
[[ $? -eq 0 ]] && echo ssh test is ok || echo ssh test is fail
but the ssh test as the last above example works even IP address is wrong , so even ssh failed then $? get 0 inspite ssh test is failed
so how to set all ssh syntax with & ?
note - the reason that I want to add & on line is because we need to scan more then 1000 linux machines and with & it will be more faster