I have a script which loops through hosts and executes commands like so
while read host; do
ssh "user@$host" 'echo "$(pwd)"'
done
the problem is some hosts ask for a password, is there a way to exit with 0 if there is a host that asks for a password?
ssh -o NumberOfPasswordPrompts=0 host.example.com
But it will exit non-zero... (specifically 255 with OpenSSH_7.9p1, LibreSSL 2.7.3
)