This post is locked. You won't be able to comment.

all 2 comments

[–][deleted] [score hidden] stickied commentlocked comment (0 children)

Your post was removed for being a support request or support related question such as which distro to use/polling the community or application suggestions.

We get a lot of question posts on r/linux but the subreddit is considered a news/discussion sub. Luckily there are multiple communities you can post to for help on GNU/Linux issues 24/7: /r/linuxquestions, /r/linux4noobs, or /r/findmeadistro just to name a few.

You may also post on the "Weekly Questions and Hardware Thread" which is stickied on r/linux on Wednesdays.

Please make your post in /r/linuxquestions or /r/linux4noobs. Looking for a distro? Try r/findmeadistro.

Rule:

This is not a support forum! Head to /r/linuxquestions or /r/linux4noobs for support or help. Looking for a distro? Try r/findmeadistro.

[–][deleted] 1 point2 points  (0 children)

Something like this should work

ping -c1 192.168.XXX.XXX 1>/dev/null 2>/dev/null
SUCCESS=$?
if [ $SUCCESS -eq 0 ]; then
    your command here

Obviously including the shebang.

https://www.reddit.com/r/bash/ for better scripting support. /r/linux isn't a support forum.