Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

Problem with past arguments in script


This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic

#1 Roggy


    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 19 May 2015 - 02:26 AM

 have a question is there any possibility for maken a script that you can see if computers are on in your network
when you run the script for ex. ./ping.sh 54 62 62 , a script when you give as argument the last digit of the ip adres of the computers

my network is

This is what i already have but i want to give extra parameters to the script
for example
parameter 1: xx-yy: this parameter ensures that all computers be test in the range of xx-yy eg. 61-67, test all the 7 computers with the last digit

parameter 2: -t , ensures that each number count with 200 eg. -t 17 test the ip adress 217 , -t 17-19 test all the adresses 217 to 219


for ip in 192.168.1.{1..10}; do # for loop and the {} operator
ping -c 1 -t 1 > /dev/null 2> /dev/null # ping and discard output
if [ $? -eq 0 ]; then # check the exit code
echo "${ip} is up" # display the output
echo "${ip} is down"

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download