[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: bash null conditional
- From: Mamoru Tasaka <mtasaka ioa s u-tokyo ac jp>
- To: "Community assistance, encouragement, and advice for using Fedora." <fedora-list redhat com>
- Subject: Re: bash null conditional
- Date: Tue, 31 Mar 2009 04:00:59 +0900
Craig White wrote, at 03/31/2009 03:27 AM +9:00:
> I'm in my bash book and looking on web but can't seem to resolve this
> simple problem.
>
> $ if [ -n "grep A121 myfile.csv" ]; then echo "null"; fi
> null
>
> $ if [ -n "grep A125 myfile.csv" ]; then echo "null"; fi
> null
>
> A125 definitely is null when I just run the grep command in the quotes
> but A121 definitely is not null.
>
> What am I missing on the if/null operator here?
>
> Craig
Maybe what you want to is:
$ if ! grep -q "A125" myfile.csv ; then echo "null" ; fi
?
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]