in message <[EMAIL PROTECTED]>,
wrote Garrett Cooper thusly...
> I was wondering if anyone could help me out with the following
> script I've developing (the grep if statements are incorrect..):
> cd /usr/src;
> if [ -n `grep -e s/KERNCONF=/ /etc/make.conf` ] # want to look for
Well, you did not write what exactly is the problem, as executing
the above works as expected. Why do have 'KERNCONF' surrounded by
's/' & '/'?
In any case, there is not need to see if the returned string length
is nonzero. Just use the grep return code & send the all the output
to /dev/null ...
if grep -e '^KERNCONF=' /etc/make.conf >/dev/null 2>&1
... or you could also use '-q' and/or '-s' grep options instead of
sending output to /dev/null. (I personally would do a bit more
strict check to see $KERNCONF is set to value containing characters
meeting some criteria, say '\<[-._[:alnum:]]+\>'.)
> KERNCONF in /etc/make.conf
> echo "enter in the kernel conf file full pathname:";
I did not know one can specify the kernel configuration path, not
just the basename.
> read KERNCONF;
> if [ -n `grep -e s/NO_CLEAN=*yes*/ /etc/make.conf` ] // want to look for
Wrong kind of comment
See above comments about grep(1) usage.
email@example.com mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"