prog then equals to :
sensor=program program="top -b -n 1 | head -12 | tail -6 | sed '/top/d' | awk '{ printf ("%10.10s %-8s %-8s %-5s" , $12,$9,$10,$2)}' " interval=4000
But when I launch superkaramba, it complains about not finding the proper quote.
/bin/bash: -c: line 0: Caractère de fin de fichier (EOF) prématuré lors de la recherche du « ' » correspondant
/bin/bash: -c: line 1: Erreur de syntaxe : fin de fichier prématurée
Clearly the problem is the double-quote in the bash script. I cannot remove the double-quote because printf does not work anymore.
The script below works fine:
test="\"top -b -n 1 | head -12 | tail -6 | sed \'/top/d\' | awk \'{ print $12,$9,$10,$2 }' | column -t \""
Does any bash/superkaramba guru how to find to find a work-around ? I spent a week on that, and I am running dry.
Thanks
Fabien
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I wrote Automatik at
http://kde-look.org/content/show.php?content=106812&forumpage=2&PHPSESSID=cae
To improve AutomatiK, I would like to add this one-line script into a text sensor :
top -b -n 1 | head -12 | tail -6 | sed '/top/d' | awk '{ printf "%10.10s %-8s %-8s %-5s\n" , $12,$9,$10,$1}'
When I type this in a shell, this gives me the expected output
To add it into a textsensor, I did the following into my python file
test="\"top -b -n 1 | head -12 | tail -6 | sed '/top/d' | awk '{ printf (\"%10.10s %-8s %-8s %-5s\" , $12,$9,$10,$2)}' \" "
prog='sensor=program program='+test+' interval=4000 '
karamba.setTextSensor(widget, TopSensorText1, prog)
prog then equals to :
sensor=program program="top -b -n 1 | head -12 | tail -6 | sed '/top/d' | awk '{ printf ("%10.10s %-8s %-8s %-5s" , $12,$9,$10,$2)}' " interval=4000
But when I launch superkaramba, it complains about not finding the proper quote.
/bin/bash: -c: line 0: Caractère de fin de fichier (EOF) prématuré lors de la recherche du « ' » correspondant
/bin/bash: -c: line 1: Erreur de syntaxe : fin de fichier prématurée
Clearly the problem is the double-quote in the bash script. I cannot remove the double-quote because printf does not work anymore.
The script below works fine:
test="\"top -b -n 1 | head -12 | tail -6 | sed \'/top/d\' | awk \'{ print $12,$9,$10,$2 }' | column -t \""
Does any bash/superkaramba guru how to find to find a work-around ? I spent a week on that, and I am running dry.
Thanks
Fabien