• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Ping error? Invalid Argument

Scheduled Pinned Locked Moved Off-Topic & Non-Support Discussion
5 Posts 3 Posters 2.5k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G
    Gabriel 3
    last edited by Oct 23, 2022, 12:30 AM

    Hello .. Good evening! I created a command, but it is giving "

    ping: invalid argument: '192.168.0.1'

    I built this code:
    #!/bin/bash

    for ip in $(seq 1 20); of

    ping -c $1.$ip | grep "64 bytes" | cut -d " " -f 4

    done

    Can someone help me?

    1 Reply Last reply Reply Quote 0
    • J johnpoz moved this topic from Wireless on Oct 23, 2022, 12:39 AM
    • S
      stephenw10 Netgate Administrator
      last edited by Oct 24, 2022, 12:08 AM

      Where are you trying to run it?

      G 1 Reply Last reply Oct 24, 2022, 8:34 PM Reply Quote 0
      • G
        Gabriel 3 @stephenw10
        last edited by Oct 24, 2022, 8:34 PM

        @stephenw10 Kali Linux! 2022

        1 Reply Last reply Reply Quote 0
        • S
          stephenw10 Netgate Administrator
          last edited by Oct 24, 2022, 9:16 PM

          Looks like it's trying to use the IP address as the ping count. Like:

          steve@steve-NUC9i9QNX:~$ ping -c 192.168.0.1
          ping: invalid argument: '192.168.0.1'
          
          1 Reply Last reply Reply Quote 0
          • T
            touchstone404
            last edited by Sep 10, 2024, 5:36 PM

            Better late than never.........

            I had a similar issue and noticed that you didn't have a number '1' after -c (presuming that you only wanted it to ping once): -c 1

            Maybe that would work.

            Cheers.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
              This community forum collects and processes your personal information.
              consent.not_received