Sponsored Content
Full Discussion: Shell Script for ping, Linux
Top Forums Shell Programming and Scripting Shell Script for ping, Linux Post 302563570 by jim mcnamara on Tuesday 11th of October 2011 02:52:31 PM
Old 10-11-2011
Code:
 ping xx.xxx.xxx > /dev/null 2>&1 && echo "ok" || echo "not ok"
# or
ping xx.xxx.xxx > /dev/null 2>&1 && echo "1" || echo "0"

The second form gives you a 1 or a zero.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script queries: $home; broadcast ping

Dear all, This is the Bionic Fysh again. I have two quick questions: 1- when writing shell scripts, how does one allow the tilda ~ into the script ? e.g ls ~; ls ~me; user=you; ls ~$user (N.B I think that for this one you need: ls `~$user`) 2- In FreeBSD 4.0, I would like for a... (6 Replies)
Discussion started by: bionicfysh
6 Replies

2. UNIX for Dummies Questions & Answers

Problem to ping Linux server

I want to access window file system through Samba. when i ping Window machine through linux machine it connect, but in reverse case it shows "Request time out". could any one suggest what problem may be. (1 Reply)
Discussion started by: sonirajesh
1 Replies

3. UNIX for Dummies Questions & Answers

Linux Shell Question: how to print the shell script name ?

Suppose I have a script named "sc.sh" in the script how to print out its name "sc.sh"? (3 Replies)
Discussion started by: meili100
3 Replies

4. Shell Programming and Scripting

Shell script to ping a range of IPs

Hi Can someone give me a shell script that can ping a range of IPs and return IPs which are not pingable. Range for example say 192.168.0.1 to 192.168.0.50 and whichever are not pingable then return the IP. Thanks for your help (3 Replies)
Discussion started by: tannu
3 Replies

5. Shell Programming and Scripting

shell script for ping

hi anyone, i want shell script for ping command. any one post here............ (10 Replies)
Discussion started by: rameshreddy.ema
10 Replies

6. IP Networking

ping to different network in linux

Hi all, please help solving my small issue below is the configuration I have 3 systems sytem1 -------- system 2 ----------system 3 system 1 : 10.255.1.4 & default gw 10.255.1.55 system2 : ip 1 : 10.255.1.55 , ip 2: 10.255.2.1 system 3 : ip : 10.255.2.3 on system 2 : ... (4 Replies)
Discussion started by: Gopi Krishna P
4 Replies

7. Shell Programming and Scripting

Unix Shell Script to ping systems & make a log

Hi, I need to ping all the systems in my network and then create a log for the ones, from where I successfully get the ping-response (ICMP packet). Now, I've used the ping command successfully, but am unable to use 'grep' command to locate the IPs for which the ping was successful (so that I... (5 Replies)
Discussion started by: psychoTHEIST
5 Replies

8. Shell Programming and Scripting

Ping shell script - need urgent help

Hi friends, i have a file contains IP address like below cat file.txt 10.223.20.1 10.223.20.2 10.223.20.3 10.223.20.4 10.223.10.5 . . . like this Now i want to make a script which gives output whether each ip is pinging or not... the result will be like this 10.223.20.1 up... (9 Replies)
Discussion started by: siva kumar
9 Replies

9. Shell Programming and Scripting

Need shell script to Telnet multiple node , Ping some IP and print output

Hi Team, Need shell script to Telnet multiple node , Ping some IP and print output like pass or fail. Need this script to check reachability of multiple nodes at same time. Help me. I use this but not working... Eg. in this script i need to telnet... (4 Replies)
Discussion started by: Ganesh Mankar
4 Replies

10. Shell Programming and Scripting

Shell script to ping multiple servers

Hi I did the following script to ping multiple servers, but I keep on receiveing duplicate emails for one server that is down: #!/bin/bash date cat /var/tmp/servers.list | while read output do ping -c 1 "$output" > /dev/null if ; then echo "node $output is up" else ... (10 Replies)
Discussion started by: fretagi
10 Replies
DEBUGREISERFS(8)					      System Manager's Manual						  DEBUGREISERFS(8)

NAME
debugreiserfs SYNOPSIS
debugreiserfs [ -dDJmoqpS ] [ -j device ] [ -B blocknumber ] device DESCRIPTION
It helps sometimes to solve problems with reiserfs filesystems. Being called w/o options it prints super block of reiserfs filesystem found on the device. device is the special file corresponding to the device (e.g /dev/hdXX for IDE disk partition or /dev/sdXX for SCSI disk partition). OPTIONS
-j device print contents of journal. Also with the option -p it allows to pack journal into archive with other metadata -J print journal header. -d print formatted nodes of the internal tree of the filesystem -D print formatted nodes of all used blocks of the filesystem -m print contents of bitmap (not very useful) -o print objectid map (not very useful) -1 blocknumber print specified block of the filesystem -p Makes debugreiserfs to find filesystem metadata This option exists to help reiserfsck debugging. If reiserfsck fails - you may extract filesystem metadata with debugreiserfs -p /dev/xxx |gzip -c > xxx.gz. We download that data and make the filesystem similar to your with gunzip -c xxx.gz | unpack /dev/xxx (unpack is included into reiserfsprogs package). This usually allows to reproduce and debug the problem quickly. When data file is not too large. -S When -S is not specified -p deals with blocks marked used in the filesystem bitmap. With this option set they will work with whole device. -q Suppress showing speed of progress when -p is in use AUTHOR
This version of debugreiserfs has been written by Hans Reiser <reiser@idiom.com>. BUGS
There are probably few of them. Please, report bugs to ReiserFS mail-list <reiserfs-list@namesys.com>. SEE ALSO
reiserfsck(8), mkreiserfs(8) Reiserfsprogs 3.6.4 January 2002 DEBUGREISERFS(8)
All times are GMT -4. The time now is 02:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy