Piping into a Case Statement embedded in a while loop
I'm attempting to pipe in a data stream to a shell script with a case statement inside of a while loop. The idea behind this is that I want to be able to test the values that come through on the stream so that I have an output of there values.
For instance If my data stream looks something like this: Code:
c2 Code:
system is up Code:
#!/bin/bash Perhaps there is a way to do this in perl using the Switch and Case commands but I haven't been able to figure that out either. Any Help is appreciated. |
Code:
#!/bin/bash |
incidentally, if you want an infinite look, you can use the true command, like this:
Code:
while true; do |
Quote:
Code:
#!/bin/bash |
I don't think you want an infinite loop in this case. read will only return false when the input closes, so your "splitting the difference" will go into a busy loop (using 100% cpu) after the input stops.
|
Furthermore, the inner while loop is superfluous.
|
All times are GMT -5. The time now is 11:11 AM. |