Miquel van Smoorenburg wrote:
In article <[🔎] 41265EB6.2050202@acu.edu>,
Kent West <westk@acu.edu> wrote:
A programmer would know this . . , but not me ;-)
I'm using a script to build a file by concatenating portions of two
other files. Then end result needs to be checked to make sure a
certain word shows up in a line.
I know that "grep programm <this email message>" would return the line:
A programmer would know this . . , but not me ;-)
but what I want returned is just the word "programmer".
BTW, why not simply
if grep -q word file
then
# word was present in file
bla
bla
fi
My test script:
#!/bin/bash
if [ `grep -q icewm /home.local/snert/.xinitrc` ] ; then
echo "Yep"
else
echo "Nope"
fi
and the result:
snert[@macs51]:/home.local/snert> ./test.sh
Nope