Results 1 to 2 of 2

Thread: ping in a bash script

  1. #1
    Join Date
    Nov 2008
    Beans
    100

    ping in a bash script

    Hello,

    I would like to setup a ping test in one of my bash scripts. But *nix pings are continuous which would make the script continue until interrupted with Ctrl+C

    How do you specify a certain number of pings to be issued?

    ***ah!!!
    ping -c $IPADDR

    nm.. figured it out..
    Last edited by bluethundr; February 13th, 2010 at 05:55 PM. Reason: figured it out

  2. #2
    Join Date
    Dec 2006
    Beans
    Hidden!
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: ping in a bash script

    Yes, but you need an integer for the number of pings after the "-c" flag. For example, if you want to do three pings it would be:
    Code:
    ping -c 3 $IPADDR

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •