Programming :: Bash Script To Ping A Range Or Own IP-range?

Apr 11, 2011

I want to build a bash script, which can ping a range IP adresses which will be filled in by the admin. If there is no IP-adress filled in, then the script must ping the subnet where the system is logged on. So if my ip is 192.168.1.6, then the script must ping from 192.168.1.1 till 192.168.1.255 Or else, if there is given a beginning and ending ip it must ping that!

The first part of the bash script is to ping a given range (see below). But there is one problem, how can I tell the script to ping from $begin till $end, [..] is of course wrong! But what must be filled in there???

echo "Enter beginning IP-adres:"
read begin
echo "Enter ending IP-adres:"
read end
ping -c 1 $begin [..] $end

The second part is to find my own ip and ping the whole range.. How to do that? I only can find my own IP, but I cant ping the whole range,, how to do that?

#!/bin/bash
ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' |
cut -d: -f2 | awk '{ print $1 }'

View 11 Replies


ADVERTISEMENT

Programming :: Bash Script - Test Variable Against A Range?

Jan 28, 2010

I am fairly new to bash scripting, and I am trying to test a variable against a number range (1-3). This is what I have used so far: The user enters a value, then

while [ "$PROV" != "1" ] && [ "$PROV" != "2" ] && [ "$PROV" != "3" ] && [ $COUNTER -lt 4 ] || [ -z "$PROV" ] && [ $COUNTER -lt 4 ]; do
clear
echo

[code]....

Is there a cleaner way to do this? Something like:

while [ "$PROV" != "1-3" ]&& [ $COUNTER -lt 4 ] || [ -z "$PROV" ] && [ $COUNTER -lt 4 ]; do

View 3 Replies View Related

Networking :: What Are Short Range Link And Long Range Links In Routing

Jun 23, 2009

get me understand the short range and the long range links from routing (and routing protocols') point of view.

View 6 Replies View Related

Software :: Gnuplot - Combining A Linear Range And Log-scale Range In The Same X-axis?

Apr 24, 2011

I want to plot a set of data in only one plot.The problem is that some points of the data should be better plotted in a linear scale (lets say 0 to 100,000) but there are other data points that, exceding the value 100,000, would be better plotted in a logarithmic scale, as they goes in the range 100,000 to 500,000,000. Let's say the data is:

Code:

X Y
0 100
10000 80
20000 75

[code]....

Is there a way to plot all these points in the same plot in only one X-axis showing two different ranges in that axis: linear: 0-100,000 logarithmic: 100,000 - 1,000,000,000?The axis would be read, for example, as:

Code:
|-----|-----|-----|-----|-----|-----|-----|-----|-----|
0 20k 40k 60k 80k 100k 1M 10M 100M 1G

(The abbreviations k-M-G are not the important point. Just shown for clarity)

View 2 Replies View Related

General :: How To Get Bash Shell History Range

Oct 4, 2010

How can I get/filter history entries in a specific range?I have a large history file and frequently usehistory | grep somecommandNow, my memory is pretty bad and I also want to see what else I did around the time I entered the command.For now I do this:get match, say 4992 somecommand, then I do history | grep 49[0-9][0-9]this is usually good enough, but I would much rather do it more precisely, that is see commands from 4972 to 5012, that is 20 commands before and 20 after. I am wondering if there is an easier way? I suspect, a custom script is in order, but perhaps someone else has done something similar before.

View 2 Replies View Related

Server :: Bash Mayhem With For Loop And Variable Range

Mar 1, 2011

As you can see on the output of the script, the two 'testing echoes' I do at the end don't print anything.That's the point, I do NEED this array further in my script.I'd understand my "param" var is local to the for, but is the other one too ? I tried to use "declare -a file" before the for, but i get same exact result !

View 2 Replies View Related

Programming :: Out Of Range Vector Iterator?

Mar 20, 2011

I'm not really a C++ noob at all, but I am a little rusty at the moment. Still, I CANNOT figure out what is wrong with the following code. I'm using Visual Studio 2010.

Code: #include <iostream>
#include <fstream>
#include <vector>
#include <string>

[Code]....

I THINK I got all of the pertinent code. Anyway, it fails at the *** line. I CANNOT figure out why. If I modify it to be linein.size()-30, it STILL gives me an error. That makes zero sense.

View 3 Replies View Related

Programming :: How To Tell Java To Print 20 When Value Is In That Range

Jul 28, 2011

I've just started programming at my university and I'm finding it a bit hard to get started. I've been given this for homework.Given 2 integers, a and b, print their sum. However, sums in the range 10..19 inclusive, are forbidden, so in that case just print 20The problem I'm having is that i don't know how to tell java to print 20 when the value is in that range.

View 14 Replies View Related

Programming :: Delete A Specific Range Of Files?

Aug 13, 2010

I have 50 files in the following format.

fileone.0001.txt
filetwo.0002.txt
filethree.0003.txt

[code]...

View 4 Replies View Related

Programming :: Replace A Certain Range Of Characters In Unix?

Mar 8, 2010

I have a hard time figuring this out. I need to replace the date formats of arrival date(column 31-40) and departure date(column 42-51) and I need 2 outputs. I cannot even figure out how to start.code...

View 6 Replies View Related

Programming :: Sed Print Range From Pattern1 To Pattern2?

Jun 14, 2011

From a file I want to extract a range of lines by patterns. I've used variations on

Code:
sed -n -e '/^BashNotes/,/^EndOf[A-Za-z]*$/ p' -e '/^EndOf[A-Za-z]*$/ q' Notes

So, I want to extract lines starting from one whose first word is specified, in this case "BashNotes", and ending at the first line consisting of the single word "EndOf...", which in this case would be "EndOfBashNotes".

Either I get no output at all, or it prints from the start of file to the first EndOf..., so the problem has to be with "^BashNotes", e.g. remove the "^" and it accesses an earlier occurrence of "BashNotes" that is in the middle of the first line of the file, and prints to the first occurrence of "EndOf...".

So why should a "^" in the "from" pattern be objectionable, when it is acceptable in the "to" pattern and the "quit" statement?

View 7 Replies View Related

Programming :: Shell: Give A Range Argument To 'for'

Feb 20, 2010

Feel free to just link to another thread where this is (pre)solved; I can't search the forum for the word "for," because it's too short (or maybe the search engine dislikes prepositions).

Is there a way to give the 'for' command a range? Here's what I mean:

Code:
#for i in (1-5); do echo $i; done
Certainly, meat space user; I understand exactly what you're thinking.
1
2
3
4
5
True, I realize I could use

Code:
COUNT=1 ; while [ $COUNT -lt 6 ]...

...but if I can avoid the extra preparatory step I'd prefer to do so.

View 2 Replies View Related

Programming :: Search Of All Files In Computer Between Range Date?

Apr 13, 2011

I'm looking for a c++ code that search for all files in computer between two input dates (example- 3.3.2011 and 11.4.2011)and copy all file in that range in new file .the user run the program and input date and path in dos system

View 8 Replies View Related

Programming :: Print A Range Of A Char Array Without A For Loop?

Nov 6, 2010

Program in CSay I have a char array of 1024 bytes called buf1.But I only want to print the chars in index 0 up to index 30. I know I could do this with a for loop. But is there any other way? What about maybe storing from 31-1024 to another char array say buf2 with strcpy and somehow popping 31+ out of the buf1 char array?

View 3 Replies View Related

Programming :: MySQL Year Field Range Too Limited

Jul 1, 2011

In the MySQL database for one of my programming projects, I used a "YEAR(4)", because I wanted the column to contain four-digit year values. I discovered, though, that this type only allows values from 1901 to 2155, which is not workable as some year values are previous to the twentieth century. But I do not want a "DATE" type because the month and day are of no interest to me. What type should I convert to that would be the least radical change in data type, while giving more range?

View 1 Replies View Related

Programming :: Perl - Stop Range Search At End Of An Array?

Dec 7, 2010

I have data that looks similar to this -

Quote:

John Smith (Address)
123 Main St
Unit 1

[code].....

So I need everything between each name, but I am not guaranteed that each time I match a name that I will have the same amount of lines, so I do a range pattern search line this to get all lines, no matter if there is 5 or 10 or 15. I simply do a loop that goes through the whole array until I hit the match, and this is my search pattern.

Code:

if ($LINE =~ /^s+$SELECTED_NAME/ ... $LINE =~ /(Address)/) {
push @ADDRESS_INFO, $LINE;
}

This works perfectly... until I hit the end and it doesn't get its final pattern match because it's at the end and there is no next entry with a (Address) line. So as a 'hack', I ended up inserting a final scalar at the end of the array that just says (Address) so it knows it's at the end. Ideally though, I'd like to do an "or" statement that says search for Address || return true if I hit the end of the array. How would I match on "End Of Array" essentially?

View 1 Replies View Related

Programming :: Gawk Statement To Match Range Of Filed For String?

Jul 30, 2010

adf 32 324 100 100 24 234I want a gawk statement to match the above line if lets sayand field between 4 and 6 == 100.

View 2 Replies View Related

Programming :: Python Error - List Index Out Of Range (Web Scrapper)

Feb 18, 2011

Having a bit of an issue with Python while trying to write a script to download every rar file on a webpage. The script successfully downloads any link that doesn't contain any spaces, etc. But when it hits a url like: [URL] (Classical Spelling).rar. It fails...I'm sure this is something simple, but I'm so new to python I'm not sure what to do!

Code:
import urllib2
import os
os.system("curl [URL] -i rar|cut -d '"' -f 2 > temp.out ")
infile =open('temp.out', 'r')
for url in infile:
print url
#url = "[URL]"

#url = target
file_name = url.split('/')[-1]
u = urllib2.urlopen(url)
f = open(file_name, 'w')
meta = u.info()
file_size = int(meta.getheaders("Content-Length")[0])
print "Downloading: %s Bytes: %s" % (file_name, file_size)
file_size_dl = 0
block_sz = 8192

while True:
buffer = u.read(block_sz)
if not buffer:
break
file_size_dl += block_sz
f.write(buffer)
status = r"%10d [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
status = status + chr(8)*(len(status)+1)
print status,
f.close()

View 7 Replies View Related

Programming :: Getting Error 'couldn't Compile Regular Expression Pattern: Invalid Character Range'

Nov 19, 2008

I'm having a bit of trouble with a regular expression I'm trying to write and I'm not sure if it's something Tcl specific or my lack of regexp understanding.

[Code]...

I get a number of strings passed to a proc in the format 3|x where x is a number, either 0 or within the range 5-12. My understanding is that that regexp will match the literal '3' followed by a '|', the escapes the special meaning of |, and then 0 or, because of |, a number within the range 5-12. However I'm getting the error 'couldn't compile regular expression pattern: invalid character range'.

View 3 Replies View Related

Programming :: Ping IP Addresses Using Bash (Online Or Unavailable)

Jun 14, 2011

I am new to linux and am trying to write a script that will ping IP addresses and say either online or unavailable.

View 3 Replies View Related

Ubuntu :: Screen Out Of Range?

May 5, 2011

My screen is always telling me "signal out of range. 75.0 KHz / 60 Hz when I have my graphic card driver installed. I have tried many ways to solve that problem and I have been tried many things that I read in many tutorials. I don't know how to solve that and I've been trying new things for nearly 2 weeks.I have tried the same thimgs in ubuntu 10.10, 9.10 and 9.04 but with no results.

View 5 Replies View Related

Debian :: How To Not Route Certain Range Of IP's Through VPN?

Nov 4, 2010

I am running a VPN (Juniper Networks client) and an ifconfig shows me that its opening a tunnel and also adding routing instructions (I think). Anyway the problem is that when I'm connected to the VPN, I lose route to all my local machines and this is getting annoying when I want to use ssh.Does anyone know how to not route a certain range of IP's through the VPN?

View 4 Replies View Related

Debian :: Input Signal Out Of Range?

Feb 15, 2011

I have been trying unsuccessfully to load Debian on my desktop. I have tried both live and otherwise. Both AMD64 and i386. It seems to be loading fine and then all of a sudden the monitor quits with a sign Input signal out of range. I have tried lots of other live disks and they have worked fine. My monitor is a Hanns G and my video card is NVIDIA GeForce8200. All other stuff very normal. 4 Gigs of RAM. What?

View 4 Replies View Related

Fedora :: F12 -- Input Signal Out Of Range?

Mar 29, 2010

I recently installed Fedora 12 -- a brand new install, not an upgrade. The system was previously using Fedora 11 without any problems. Fedora 12 installed without any issues, and I haven't really done any customization to it. I am running KDE. The system is hooked up a KVM switch.

When I am on system #2 (a Windows system) and I switch back to system #1 (Fedora) after a few minutes of time, the Fedora screen will be blank and the monitor will present an "input signal out of range" error. I can SSH into the box and kill X to get the screen back. This has not happened on this system with any previous versions of Fedora that had been running on it (everything since Fedora 7).

View 3 Replies View Related

OpenSUSE Network :: IP Range In Firewall?

Mar 29, 2010

I am trying to add a custom allow rule in the firewall for a range of IPs from 74.201.102.0 - 74.201.103.255, what exactly am I supposed to enter in the source box? I believe I have to add two separate rules for 102 and 103, and I put /24 at the end of both, is this correct to get the whole range of IPs?

View 3 Replies View Related

OpenSUSE Network :: PXE, Bad Subnet IP Range?

Dec 26, 2010

I have been trying to get a DHCP PXE server up for a few days now, this is what I got so far..I am following this how-tohere are some outputs and what-nots, go to the last one to see the problem I am having.the host network

Code:
:~> /sbin/ifconfig
br0 Link encap:Ethernet HWaddr 00:19:DB:62:97:20

[code]....

View 9 Replies View Related

OpenSUSE Wireless :: Range Of Less Than 3 Feet?

Dec 31, 2009

I thought I would drop a few findings relating to a strange problem I don't have the answer to.

I have installed both Ubuntu and now OpenSuse (alongside Windows XP) on a thinkpad T40. I own a linksys WRT54G2 wireless router.

Windows XP runs fine, and connection to the wireless network is fine everywhere in the house.

however the first time on Ubuntu and now on Opensuse 11.2, the laptop needs to be within 3 feet of the router in order to connect to the wireless network!

Strange thing is that the laptop can see the network from anywhere in the house (with a signal strength carying between 60 and 90%) - however impossible to connect.

Suse is running the ath5k driver for the internal network card.

View 2 Replies View Related

General :: Moniter Out Of Range Error / Fix This?

Jul 30, 2010

I just installed Debian lenny 5.0.5 and when i start it up the monitor just displays a 'out of range' error. im using a Radeon HD 5570 graphics card and a lG W2353V-PF monitor.

what do i have to do to fix this problem?

View 2 Replies View Related

Ubuntu Installation :: Out Of Range On Boot?

Apr 30, 2011

Got the problem where after the Bios loads my screen just says "out of range" and I cant do anything else. Running on a live cd.

View 7 Replies View Related

Ubuntu :: Recommended Vm.swappiness Set Range?

Jun 26, 2011

Lately I have been reading up on vm.swappiness. What range would you recommend I look at, my system is:

- AMD 64 X2 6000
- 8 GB on-board memory
- plenty of HD space

Usually I have only one or two programs open at a time....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved