error while executing bash script same as the authorAdvanced Penetration Testing Course

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATION
Already a Member Login Here

Home Forums Courses Advanced Penetration Testing Course error while executing bash script same as the author

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Anonymous 1 year, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #108248

    Amrithmmh
    Participant

    GNU nano 2.8.7 File: ping.sh

    #!/bin/bash
    if [ “$1” == “” ]
    then
    echo “Usage: ./ping.sh [network]”
    echo “Example: ./ping.sh 192.168.1”
    else
    for x in ‘seq 1 254’ ; do
    ping -c 1 $1.$x
    done
    fi

    if i do ./ping.sh 192.168.1
    output:ping 192.168.1.sq name or service not known
    how to correct?

    #116421

    Anonymous
    Participant

    The seq command is outdated and may not work in all Linux distributions. As an alternative try $(seq 1 254) and if that doesn’t work, the more up-to-date way of writing a bash script for loop is:

    for i in {1..254}
    do
       echo $i
    done
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Cybrary On The Go

Get the Cybrary app for Android for online and offline viewing of our lessons.

Get it on Google Play
 

Support Cybrary

Donate Here to Get This Month's Donor Badge

 
Skip to toolbar

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel