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.

5
  • 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, 2015 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. Feb 10, 2015 at 11:52
  • Oh, I see. I guess it was copy/paste. I changed the } to fix the example Feb 10, 2015 at 11:53
  • So, it doesn't work like that either, right?
    – aguslr
    Feb 10, 2015 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 Feb 10, 2015 at 12:00

1 Answer 1

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .