I have following script
grep -e . testFile |jq -e ".fundingMoved.\"com.test\".map.\"java.util.HashMap\" |if .TRANSACTION_DESTINATION? then(.AGREEMENT_OWNING_ORG | startswith(\"MXN\")) and (.TRANSACTION_DESTINATION |startswith(\"BRL\")) or(.AGREEMENT_OWNING_ORG | startswith(\"MXN\")) and (.TRANSACTION_DESTINATION |startswith(\"CAD\")) or(.AGREEMENT_OWNING_ORG | startswith(\"MXN\")) and (.TRANSACTION_DESTINATION |startswith(\"USD\"))else(.AGREEMENT_OWNING_ORG | startswith(\"USD\")) and (.WAREHOUSE |startswith(\"AUD\")) or(.AGREEMENT_OWNING_ORG | startswith(\"USD\")) and (.WAREHOUSE |startswith(\"AED\")) or(.AGREEMENT_OWNING_ORG | startswith(\"USD\")) and (.WAREHOUSE |startswith(\"EGP\"))end"If testFile has match then i am seeing true and if no match then i am seeing false
I am using this script in some legacy system so it is taking only grep as argument so i am using grep along with jq.
Even though jq return false, somehow grep is interpreting that as match and perform action.
I tried with -e still i am seeing true/false instead of exit status
what i am trying to do ?
My grep should return right status code.
If my condition is true in Jq then my grep should success and if my jq return false then my grep exit code should be non zero.
How do i return exit status code from jq instead of true/false. Currently jq is returning true or false hence grep is considering everything as match.