I don't think this is the problem, == and = both work in this case, the
if statement does not check the return value of the command (bash
function) CheckPolicy but the stdout

from the bash manpage:

       string1 == string2
              True if the strings are equal.  = may be used in place of == for
              strict POSIX compliance.


Demo script:
#!/bin/bash

function CheckPolicy() {
        echo 0
}

CheckPolicy
if [ `CheckPolicy` = 0 ]; then echo null;else echo one; fi
if [ `CheckPolicy` == 0 ]; then echo null;else echo one; fi

function CheckPolicy() {
        echo 1
}

CheckPolicy
if [ `CheckPolicy` = 0 ]; then echo null;else echo one; fi
if [ `CheckPolicy` == 0 ]; then echo null;else echo one; fi

======
When run this outputs the following:

0
null
null
1
one
one

-- 
lid.sh doesn't check for gnome-power-manager
https://bugs.launchpad.net/bugs/31559
You received this bug notification because you are a member of Ubuntu
Bugs, which is a direct subscriber.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to