5

I have a file when the line 15 has the full path to an icon. That said, I want to display that icon using the ${image} variable:

${image myImage.png -p 0,10 -s 50x50}

To get the line value, I would use sed:

${exec sed -n '15p' $HOME/.Shell/Conky/ConkyWeather/dataWeather.txt}

My question is, how can I do both things together? My current code is not working. I tried:

${image ${exec sed -n '15p' $HOME/.Shell/Conky/ConkyWeather/dataWeather.txt} -p 0,10 -s 50x50}

And:

${image exec sed -n '15p' $HOME/.Shell/Conky/ConkyWeather/dataWeather.txt -p 0,10 -s 50x50}

So, how can I make a variable work inside a variable and call exec inside image? Btw, if you know any other way to read the line and insert into image, it will do as well.

  • The nesting in your 1st example seems to be wrong: ${image ${exec sed -n '15p' $HOME/.Shell/Conky/ConkyWeather/dataWeather.txt} -p 0,10 -s 50x50} – aguslr Feb 10 '15 at 11:47
  • I'm not sure how to nest variables in conky. I couldn't find anywhere explaining how to do it. It's problably wrong. – Eduardo Fernandes Feb 10 '15 at 11:52
  • Oh, I see. I guess it was copy/paste. I changed the } to fix the example – Eduardo Fernandes Feb 10 '15 at 11:53
  • So, it doesn't work like that either, right? – aguslr Feb 10 '15 at 11:54
  • No. I checked only the $ {exec} expression and it's working fine. I checked only the ${image} expression and it's working fine. But if I use the exec to suplly the image file for image, nothing – Eduardo Fernandes Feb 10 '15 at 12:00
0

As a workaround, you can try backticks.

Test backticks: ${exec echo `echo foo` bar}

Visual result:

conky command with backticks

From the above result, you may try

${image `sed -n '15p' $HOME/.Shell/Conky/ConkyWeather/dataWeather.txt` -p 0,10 -s 50x50}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.