Mourning the loss of our friend, WhitPhil.
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 audio black screen blue screen boot bsod connection crash dell desktop driver dvd email error excel firefox hard drive hardware hijackthis internet keyboard laptop malware monitor network networking outlook problem processor recovery registry cleaner router safe mode screen slow sound spyware tdlwsp.dll trojan upgrade vba video virus vista vundo windows windows 7 windows vista windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
scripting problem

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

Closed Thread
 
Thread Tools
soulfly's Avatar
Member with 48 posts.
 
Join Date: May 2004
Experience: Beginner
03-Apr-2005, 10: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
Distinguished Member with 14,989 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: IIAHYAYCESA,YAADA!
03-Apr-2005, 10: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, 10:34 AM #3
how can i test the existence of a directory?

should i use a conditional statement?
Squashman's Avatar
Distinguished Member with 14,989 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: IIAHYAYCESA,YAADA!
03-Apr-2005, 10:52 AM #4
if....
Squashman's Avatar
Distinguished Member with 14,989 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: IIAHYAYCESA,YAADA!
03-Apr-2005, 12: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, 04: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
Distinguished Member with 14,989 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: IIAHYAYCESA,YAADA!
03-Apr-2005, 10: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
03-Apr-2005, 11:30 PM #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.
Closed Thread Bookmark and Share

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.

Smart Search

Find your solution!



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


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 01:31 PM.
Copyright © 1996 - 2009 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.
Powered by Cermak Technologies, Inc.