Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

bash grep

Name: Anonymous 2012-02-27 13:29

How do I grep a given path and not the contents of the file in bash? ls won't work because the path is actually an input file, $1. Thanks.

Name: Anonymous 2012-02-27 23:54

>>7
oh I see. Yeah, ops solution in >>4 looks good.


$ WABS=hello
$ if echo $WABS | grep hell > /dev/null; then echo "haha it contained hell!"; else echo "it did not contain hell"; fi
haha it contained hell!
$ WABS=welcome 
$ if echo $WABS | grep hell > /dev/null; then echo "haha it contained hell!"; else echo "it did not contain hell"; fi
it did not contain hell

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List