Yes
June 17th, 2010, 08:22 PM
Since my ACPI handler.sh script isn't working like it should, I need to write my own. What it needs to do is test whether `acpi -a` equals "Adapter 0: on-line" or "Adapter 0: off-line". Here's what I've tried...
!#/bin/sh
power_source = `acpi -a`
if [$power_source = "Adapter 0: on-line"]
then
echo "Using AC power"
else
echo "Using battery"
fi
What it does, however, is print out "Using battery" even when acpi -a says the AC adapter is on-line. So I assume it's a problem with my if statement, right? What's wrong with it though, I haven't been able to figure out.
So, any help would be greatly appreciated. Thanks!
!#/bin/sh
power_source = `acpi -a`
if [$power_source = "Adapter 0: on-line"]
then
echo "Using AC power"
else
echo "Using battery"
fi
What it does, however, is print out "Using battery" even when acpi -a says the AC adapter is on-line. So I assume it's a problem with my if statement, right? What's wrong with it though, I haven't been able to figure out.
So, any help would be greatly appreciated. Thanks!