Re: [PATCH nft 1/5] tests: add feature probing

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

 



On Tue, Sep 05, 2023 at 04:09:20PM +0200, Florian Westphal wrote:
> Phil Sutter <phil@xxxxxx> wrote:
> > Sure, because that's a short-cut for '[ -n false ]'. In what context is
> > that problematic?
> 
> if [ $HAVE_NFT_foo ] ; then ...

Same as if $HAVE_NFT_foo was either 0 or 1?! Obviously, with variables
holding the string "true" or "false", one has to test them either via:

| if $var; then ...

or

| if [ $var == true ]; then ...

I just find code more straightforward which does "if $have_foo; then
..." instead of "if [ $have_foo -ne 1 ]; then ...". The latter makes me
question whether that 1 is positive (as with C) or negative (as with
shell) and whether there are more possible values than two and any but 1
are OK.

Cheers, Phil



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux