There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Linux and Unix
Tag Cloud
access acer asus bios bsod computer crash driver drivers error ethernet excel freeze gaming google gpu graphics hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry repair router security slow software sound trojan usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
scripting problem

Reply  
Thread Tools
soulfly's Avatar
Member with 48 posts.
 
Join Date: May 2004
Experience: Beginner
03-Apr-2005, 11:12 AM #1
scripting problem
Hello everyone.

I'm one of the many person who are just starting to use linux (suse). I'm also a beginner in scripting (in suse linux).

Can anyone help me here with my homework. It is about scripting. The questions are listed below.

Create a script that would check if a certain interface hasn't been receiving any packets/bytes from the network. You can know such by checking whether the second column after the interface name (e.g. eth0 would have a value of 0.
Should it encounter ethernet devices (devices that start with eth), save the name of the network interface to the file named
ifnet_inactive.

1. Test first for the existence of /proc/net/dev.
2. There would be an extensive need to use POSIX regular expressions and sub-expressions (expressions contained inside parentheses).
3. Use sed to format the output of /proc/net/dev. You need to suppress the automatic printing of pattern space when giving the sed action for printing the current pattern space.
4. The interface name is only 4 characters long. You need to save only the interface name and NOT anything more (such as the colon punctuation mark). You can use the cut utility for this.
5. You'd use pipelining and redirection extensively.
Squashman's Avatar
Trusted Advisor with 18,705 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
03-Apr-2005, 11:16 AM #2
Well, I dont like giving people the exact answers. You start with something and I will chime in. You can start by reading the man page for test.
soulfly's Avatar
Member with 48 posts.
 
Join Date: May 2004
Experience: Beginner
03-Apr-2005, 11:34 AM #3
how can i test the existence of a directory?

should i use a conditional statement?
Squashman's Avatar
Trusted Advisor with 18,705 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
03-Apr-2005, 11:52 AM #4
if....
Squashman's Avatar
Trusted Advisor with 18,705 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
03-Apr-2005, 01:36 PM #5
Here are some great tutorials for Bash Scripting.
http://www.freeos.com/guides/lsst/
http://www.tldp.org/LDP/abs/html/
tsunam's Avatar
Senior Member with 1,246 posts.
 
Join Date: Sep 2003
Experience: Linux~su
03-Apr-2005, 05:10 PM #6
couple of hints if and sed and | for piping will be your friends.

We will help if you start to show us some code, but we don't do your homework for you. Thank you about being honest about it being homework though
Squashman's Avatar
Trusted Advisor with 18,705 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
03-Apr-2005, 11:33 PM #7
Quote:
Originally Posted by tsunam
couple of hints if and sed and | for piping will be your friends.
And don't forget our good buddy AWK. But I am already thinking you could accomplish this without SED or AWK.
tsunam's Avatar
Senior Member with 1,246 posts.
 
Join Date: Sep 2003
Experience: Linux~su
04-Apr-2005, 12:30 AM #8
Well i'm sure you could, but as it being a class asignment,showing up the teacher and doing it without is a bad idea. Especially when the instructions specifically call for it.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 05:15 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.