Answer the question
In order to leave comments, you need to log in
How to drive nc into a variable?
this is how it works
nc -z -v -w2 $IP 1992
if [ $? -ne 0 ]; then
curl "https://api.telegram.org/$TOKEN/sendMessage?text=Не удалось соединиться&chat_id=$CHAT"
fi
STATUS=$(nc -z -v -w2 $IP 1992)
if [ $STATUS -ne 0 ]; then
curl "https://api.telegram.org/$TOKEN/sendMessage?text=Не удалось соединиться&chat_id=$CHAT"
fi
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question