Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am trying to write a scipt that can work with a utility on one of my switches. The switch has some error logging. As it finds errors it's makes a small file (lets call it smallerror) that it appends to a larger file that has all my errors (lets call that bigerror)
The switch will also pipe the smallerror file into scripts that I have written. I want to write a script that will grep for data in smallerror and then react appropriately. The problem is, my script is only meaningful if it is run at the time the error is detected so I cant use the cron command to schedule my script, it needs to be as soon as the switch detects the error. The switch will do this for me, if I knew how the write the script but I have some problems.
I have 2 problems, one you guys cant help me with and 1 that maybe you can.
1) I dont know exactly what the switch means by it 'pipes' the info to my script. I'm assuming that it does something like this:
cat smallerror | myscript
but I cant be certain till I get my script working. You guys cant really help me with this one.
2) BUT you can help me with this. Assume that what I say is true and that the switch is using the cat command to pipe the data. How do I get the script to work with info that is piped in that way? I know how to use $0, $1, $2, etc to get info entered after the command line of my script, but I do not know how to work with info that gets piped in. I have a feeling that it's a simple fix but I've surfed around and asked around and I dont have anything.
Last time I worked with unix was 10 years ago so I may not be giving info that you need to solve this, but anything you could tell me would be appreciated. Thanks.

![]() |
X-windown
|
Pascal or Ada-95 on Sco U...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |