PDA

View Full Version : Quick bash script question



pylon42
November 7th, 2007, 03:40 PM
I'm not a programmer. I'm just messing around with a bash script tutorial cause it looks fun and I'm bored at work.

Is there a way to get commands such as: grep, awk, and sed to refer within the script rather than looking for external files?

Ex:

grep PING blahPINGblah

where "blahPINGblah" is a string and not an external file reference?

PaulFr
November 7th, 2007, 03:58 PM
echo blahPINGblah | grep PING

OR

echo blahPINGblah | grep -q PING
echo $? (check return status of 0, 1, 2)man grep for details of grep.

pylon42
November 7th, 2007, 04:08 PM
Thank you kindly