Re: bash null conditional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Craig White wrote:
I'm not doing classwork...a little too old for that I think.

I sort of did need the 'if' because I took the line out of a context
from a bigger shell script that does more than this and reduced it down
to the simplest form first for my trial and error and then for the list.

Thanks though...I sort of had those in mind when I started but the
context gets deeper - thus the if [ grep -c some_expression file -eq 0 ]; then ...
did the job nicely.

Heck, if you want to simplify even further, don't bother with the '['
command and just use the return code from 'grep':

    if grep -q some_expression file; then
        echo "grep found something"
    fi

--
Bob Nichols     "NOSPAM" is really part of my email address.
                Do NOT delete it.

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux