2

At http://sourceforge.net/projects/auroraconkytheme/ I have this theme for conky.

One of the scripts gets a cover from the internet for the current playing song.

The script reads out the new_trackid (current song) from spotify and compares it to the first_trackid (previous song).

If they (new_trackid and first_trackid) don't match, it gets the cover of the new song aka the song has just changed.

I previously worked with writing the variables to text files.

I came across 'export' and i tried that. It seemed to work just fine by I now discovered it was comparing a number (new_trackid) with an empty variable(first_trackid).

Basically every time conky runs the scripts it forgets the variable first_trackid. Export does not work in this case.

So it keeps downloading the cover every 5 seconds (script of conky).

What am i missing?

How can i make Linux remember the variable first_trackid without using a text file next time it runs this script?

Or how to pass one variable to the same script next time it runs?

There is a lot to read about these issues. Env, source, .bashrc... There must be a nicer way to do this. Thanks


Ps. code pasting was unreadable

1
  • What is the objection to using a file? That's what files are for - storing stuff! Make it a hidden file (starting with a dot) if you don't want to see it. Commented Feb 15, 2015 at 10:16

1 Answer 1

1

Using a file is really the right way to keep state.

The reason is that the export won't affect the environment of the parent process (your shell or cron), only itself and its children.

If running from a shell, you could source the script directly:

source ./yourscript.sh

This will evalulate it directly in your current shell, so export will effect your environment.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.