but this do not give any result, if i give the command in a console:
var1=`acpi -b | awk -F', ' '{print $2}' | cut -b 1-3` & if [ "$var1" = 100 ]; then echo "giusti" ; else echo "sbagliato"; fi
the result is given, "giusti" if $var1=100 and "sbagliato" if $var1 <> 100.
Why in superkaramba the result is not given? have you any suggestion?
many thanks for any answer
pierluigi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you very much, the first problem is solved, it run ok in this way:
program="var1=`acpi -b | awk -F', ' '{print $2}' | cut -b 1-3` & if [ '$var1' = 100 ]; then echo 'giusti' ; else echo 'sbagliato'; fi"
but if I want to show $var1 it doesn't show, for example
if $var1=100 is ok it shows "Batteria carica" but else it shows:
$var1(not the value but the string $var1) if I write else echo '$var1'; fi
anything if I write else echo $var1; fi
anything if I write else echo \"$var1\"; fi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to change an icon on my superkaramba theme depending on the result of an if statement,
the example is this:
text x=100 y=60 sensor=program program="var1=`acpi -b | awk -F', ' '{print $2}' | cut -b 1-3` & if [ "$var1" = 100 ]; then echo "giusti" ; else echo "sbagliato"; fi" interval=10000
but this do not give any result, if i give the command in a console:
var1=`acpi -b | awk -F', ' '{print $2}' | cut -b 1-3` & if [ "$var1" = 100 ]; then echo "giusti" ; else echo "sbagliato"; fi
the result is given, "giusti" if $var1=100 and "sbagliato" if $var1 <> 100.
Why in superkaramba the result is not given? have you any suggestion?
many thanks for any answer
pierluigi
I think it is because of the quotation marks (")
Try replacing the "s with 's or \"s inside the program=""
i.e.
program="var1=`acpi -b | awk -F', ' '{print $2}' | cut -b 1-3` & if [ '$var1' = 100 ]; then echo 'giusti' ; else echo 'sbagliato'; fi"
or something like this...
Orcan
Thank you very much, the first problem is solved, it run ok in this way:
program="var1=`acpi -b | awk -F', ' '{print $2}' | cut -b 1-3` & if [ '$var1' = 100 ]; then echo 'giusti' ; else echo 'sbagliato'; fi"
but if I want to show $var1 it doesn't show, for example
program="var1=`acpi -b | awk -F', ' '{print $2}' | cut -b 1-3` & if [ '$var1' = 100 ]; then echo 'Batteria carica' ; else echo $var1; fi"
if $var1=100 is ok it shows "Batteria carica" but else it shows:
$var1(not the value but the string $var1) if I write else echo '$var1'; fi
anything if I write else echo $var1; fi
anything if I write else echo \"$var1\"; fi