On Tue, 2018-07-31 at 10:48 +0200, Matt Darfeuille wrote: > > The attached patch (MUTEX_ON_TAKE1.patch) includes: > - MUTEX_ON.patch > - MUTEX_ON1.patch > - The above correction (changing 'openwrt' to 'lockbin') > - My take on fixing the above error ( "/sbin/shorewall-lite: line 14: > -n: not found") > > Brian/Tom, thoughts?
Yeah. The use of "test" in that patch was a new one on me so I had just assumed the use was correct. But even in a bash shell here, that syntax doesn't work: $ foo=[ -n "$foobar" ] bash: -n: command not found Nor do any more fully qualified uses of it (to eliminate shell interpretation as being the cause of the problem): $ foo=\[ -n "$foobar" ] bash: -n: command not found $ foo=/bin/[ -n "$foobar" ] bash: -n: command not found $ foo=/bin/test -n "$foobar" bash: -n: command not found What does work (doesn't produce a syntax error) is: $ foo=$([ -n "$foobar" ]) $ echo $foo $ foobar=foobar $ foo=$([ -n "$foobar" ]) $ echo $foo $ but I can't see how that helps us since $foo is the same when the test passes and fails. The best approximation of what I think Tom was trying to achieve is: $ unset foobar $ [ -n "$foobar" ] $ echo $? 1 $ foobar=foobar $ [ -n "$foobar" ] $ echo $? 0 But that still doesn't give us a "boolean" type value in $openwrt that we can use in if statements. So, I think what we want is: if [ -n "$lockbin" -a -h "$lockbin" ]; then openwrt=true else openwrt=false fi Cheers, b.
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Shorewall-users mailing list Shorewall-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/shorewall-users