View Single Post
  #6   (View Single Post)  
Old 2nd January 2016
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,132
Default

I tried to enable POSIX mode but disabled that with #set -o posix (see the second post) when I found the POSIX documents.
While missing from POSIX test(1), these < and > operators are in POSIX expr(1).

With Linux expr works:
Code:
$ if expr 'zzz' \> 'aaa' ; then echo Greater ; fi
Greater
But OpenBSD as well as FreeBSD, besides setting the error level, write a "1" or "0" followed by a <newline> to standard output, as mandated by POSIX :
Quote:
The expr utility shall evaluate the expression and write the result, followed by a <newline>, to standard output.
So in those BSD's you get:
Code:
$ if expr 'zzz' \> 'aaa' ; then echo Greater ; fi
1
Greater
That would mess up the output of the shell script that I was writing, unless you redirect that to /dev/null. But I found that too messy, so I sticked with /bin/test for now
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 2nd January 2016 at 06:30 PM.
Reply With Quote