Re: [Bashburn-info] Nick, I'm reverting the change you made to configfunc.sh
Brought to you by:
bashburn
From: Steven W. O. <st...@sy...> - 2008-09-29 17:21:57
|
On Monday, Sep 29th 2008 at 13:07 -0000, quoth Nick Warne: =>On Mon, 29 Sep 2008 12:55:32 -0400 (EDT) =>"Steven W. Orr" <st...@sy...> wrote: => =>> (( ${!BB_CONFIG_VAR} == 0 )) && return 1 =>> =>> This is correct. BB_CONFIG_VAR is either equal to BB_CONFIG_MODIFIED =>> or BB_ADVANCED_CONFIG_MODIFIED. So what I'm doing is to test to see =>> if the correct variable is set to 1 or 0. =>> =>> You can't test to see if it's true unless you set it equal to the =>> string 'true'. Also, if you really meant the return value of the true =>> program then that's something else entirely. =>> => =>Well, if I go to the config menu, I get this if I exit ~ without/or with =>~ changing anything: => =>/usr/lib/Bashburn/lib/func/configfunc.sh: line 32: ((: == 0 : syntax =>error: operand expected (error token is "== 0 ") => =>If I set it to read => =>${BB_CONFIG_VAR} == true => =>all works and functions correctly. => =>Surely in bash, a $VAR that == 0 is TRUE, == 1 is FALSE (I am teaching =>you to suck eggs here ;-) ). I need more info. I'm not getting a syntax error. Just so you know what's happening, (( ${!BB_CONFIG_VAR} == 0 )) && return 1 says, "Indirect through BB_CONFIG_VAR and see if it's value is 0. BB_CONFIG_VAR is only ever equal to either BB_CONFIG_MODIFIED or BB_ADVANCED_CONFIG_MODIFIED. Both of those variables are declared to be of type integer using typeset -i typeset -i BB_CONFIG_MODIFIED=0 typeset -i BB_ADVANCED_CONFIG_MODIFIED=0 So, if you test (( ${BB_CONFIG_VAR} == 0 )) it will always be false. And if you test to see if it's equal to 'true' then that's a problem also because you're testing it inside an arithmetic test, i.e. (( )) instead of [[ ]]. Because bash does not require integer variables to be preceeded by a dollarsign in an arithmetic context, it should complain that there is no variable called true but instead it just converts the true to a 1 because it's not equal to 0. Something is going on where you might have (for some reason I don't know about) a value for BB_CONFIG_VAR of null (""). I need to see more about why you're getting a syntax problem. -- Time flies like the wind. Fruit flies like a banana. Stranger things have .0. happened but none stranger than this. Does your driver's license say Organ ..0 Donor?Black holes are where God divided by zero. Listen to me! We are all- 000 individuals! What if this weren't a hypothetical question? steveo at syslang.net |