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

Re: bash null conditional



Craig White wrote:
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

I believe it's

   if [ -z "grep A121 myfile.csv" ]; then echo "null"; fi

--
Article. VI. Clause 3 of the constitution of the United States states: "The Senators and Representatives before mentioned, and the Members of the several State Legislatures, and all executive and judicial Officers, both of the United States and of the several States, shall be bound by Oath or Affirmation, to support this Constitution; but no religious Test shall ever be required as a Qualification to any Office or public Trust under the United States."


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