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 2 years, 3 months 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 accessible for everyone, everywhere. Everyone deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is the world's largest 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.

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel