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:
I want to have an output stream that looks like
Code:
system is up
system is up
system is up
system is up
system is down
system is up
I was trying to script it something like:
Code:
#!/bin/bash
while [ 1 -le 1 ]
do
case in
c2) echo "system is up";;
a1) echo "system is down";;
*) echo "invalid input";;
esac
done
However I have no idea what to put in between the "case in" statement so that it will read the input from a pipe "|".
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.