LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-22-2002, 04:06 PM   #1
ewarmour
LQ Newbie
 
Registered: May 2001
Posts: 19

Rep: Reputation: 0
BASH shell script help


I want to make shell script that takes a list of host names on my network as command line arguments and displays whether the hosts are up or down, using the ping command to display the status of a host and a for loop to process all the host names. Im new to shell scripting so Im not quite sure where to start with this. Thanks for any help -E
 
Old 05-22-2002, 06:13 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,000
Blog Entries: 11

Rep: Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893
Re: BASH shell script help

Quote:
Originally posted by ewarmour
I want to make shell script that takes a list of host names on my network as command line arguments and displays whether the hosts are up or down, using the ping command to display the status of a host and a for loop to process all the host names. Im new to shell scripting so Im not quite sure where to start with this. Thanks for any help -E
Heh ... what you want is not help, it's someone else to do your job m8

Cheers,
Tink

P.S.: I'm new at driving, could you go to the supermarket for me?
 
Old 05-23-2002, 10:57 AM   #3
ewarmour
LQ Newbie
 
Registered: May 2001
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks for nothing

Actually I was hoping for a push in the right direction. I got a link form a post at another forum http://www.tldp.org/LDP/abs/html/index.html this is good help.

-E

PS Thanks for wasting my time
 
Old 05-23-2002, 11:43 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967Reputation: 1967
please do not double post messages.... did you not have time to read the terms of using this site?
http://www.linuxquestions.org/questi...threadid=21568
 
Old 05-23-2002, 12:22 PM   #5
ewarmour
LQ Newbie
 
Registered: May 2001
Posts: 19

Original Poster
Rep: Reputation: 0
Non-*NIX Forums

I saw that this was a non-*nix forum, and I had a Unix question. My bad, wont happen again. -E
 
Old 05-23-2002, 04:47 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,000
Blog Entries: 11

Rep: Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893
Re: Thanks for nothing

Quote:
Originally posted by ewarmour
PS Thanks for wasting my time [/B]
Lovely attitude :)

http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html

Cheers,
Tink
 
Old 05-23-2002, 05:00 PM   #7
ewarmour
LQ Newbie
 
Registered: May 2001
Posts: 19

Original Poster
Rep: Reputation: 0
Like that do ya?

Just a little busy, clients from hell with spineless project managment... My bad. Thanks for your help though, I pretty much got it sorted out. -E
 
Old 05-24-2002, 08:55 AM   #8
vfs
Member
 
Registered: Apr 2002
Location: Brazil
Distribution: Slackware
Posts: 184

Rep: Reputation: 30
Try this baby johnny:

#!/bin/sh

for i in $@
do
ping $i >> /my/log/file
done

# EOF

All you have to do is read regularly the log. Or mail it for U.

HTH,

vfs
 
Old 05-24-2002, 08:57 AM   #9
vfs
Member
 
Registered: Apr 2002
Location: Brazil
Distribution: Slackware
Posts: 184

Rep: Reputation: 30
Forgot to put this in the code: Try learning ping options (which I don't know) to ping once or for a predetermined time, or you'll end with a big log of nothing...

sorry,
vfs
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with bash shell script !! taiwf Linux - Newbie 5 06-11-2006 07:07 PM
Bash Shell script bd1308 Linux - Hardware 9 08-22-2005 06:38 PM
bash shell script globeTrotter Linux - Newbie 5 06-03-2004 06:07 AM
bash shell script naka0naka Linux - Newbie 7 05-28-2004 04:06 PM
bash/shell script mikis Programming 2 10-14-2003 12:39 PM


All times are GMT -5. The time now is 04:27 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration