I'm trying to brute-force this pin in a challenge, The output of the nc localhost 30002 is: "Wrong! Please try Again" if its wrong. I wanted to put an IF condition to check if the output is different from "Wrong!" and stop the FOR loop
#!/bin/bash
for ((i=1000;i<10000;i++));
do
echo "$i" | nc localhost 30002 >> /tmp/script_dir/output &
sleep 1
done