[SOLVED]Script works in Terminal but not Conky

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
Jator
Level 2
Level 2
Posts: 80
Joined: Sat Mar 13, 2021 10:58 am

[SOLVED]Script works in Terminal but not Conky

Post by Jator »

When I run the following script in a terminal window, it produces the expected results:

Code: Select all

curl -s http://192.168.0.2/stats/h1/index.html | grep -A11 'Key Rate' | tail -1 | sed -r 's/^[[:space:]]*([^[:space:]]*).*$/\1/' | xargs printf "%'d\n"
However, when I run it within Conky (actual .conkyrc file, not a seperate script):

Code: Select all

${execi curl -s http://192.168.0.2/stats/h1/index.html | grep -A11 'Key Rate' | tail -1 | sed -r 's/^[[:space:]]*([^[:space:]]*).*$/\1/' | xargs printf "%'d\n"}
Conky Crashes and when I check in a terminal what the error is, I get the following:

Code: Select all

conky: Syntax error (/home/jay/.conkyrc:250: nesting of [[...]] is deprecated near '[') while reading config file. 
conky: Assuming it's in old syntax and attempting conversion.
conky: [string "..."]:139: attempt to index local 'settings' (a nil value)
Any thoughts on what I am doing wrong? Running Conky 1.10.8

TIA
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Script works in Terminal but not Conky

Post by rene »

Know bug it seems; f.e. https://github.com/brndnmtthws/conky/issues/470

Try and see if conky also misparses sed -r 's/^\s*([^[:space:]]*).*$/\1/'; maybe no [[ saves you...
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Script works in Terminal but not Conky

Post by AndyMH »

Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Locked

Return to “Scripts & Bash”