Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a shell script that exports values of variables when executed. The same values will be used in another script.

export I="10"
echo $I

I will be using root access for cron. I tried this command:

*/5 * * * * /home/ubuntu/backup/

After it ran, I checked the environment variables, and nothing was updated.

How do I run this script in cron and get it to properly export variables?

share|improve this question
up vote 1 down vote accepted

export only makes variables available to sub processes, not to existing shells, or even shells that run later.

Only those called by would see the new environment variables.

While this answers your question, you may want to edit it to describe what you are trying to achieve - why you want to do this, so that you'll get better answers, different approaches.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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