Reputation: 121
I am having a script runonce.sh who calls another script setup.sh through cron. We consider this case as ideal case where "TERM environment variable not set." is seen in output of runonce.sh script.
Now I am facing a problem that another third simple script - upgradeAndTest.sh when calls setup.sh, that time also "TERM environment variable not set." is seen in output of upgradeAndTest.sh script. Why is so..?
Also, if I redirect stderr of setup.sh to stdout in calling script then also "TERM environment variable not set." displays on console.
Can any one help me to remove this line from stdout of calling script..?
Upvotes: 12
Views: 19524
Reputation: 753695
Running a program that demands a terminal via cron
can lead to problems; it won't have a terminal when it is run by cron
.
In case of doubt, though, ensure that the variable is set in the script, by adding a line:
export TERM=${TERM:-dumb}
If the environment variable TERM
is already set, this is a no-op. If it is not, it sets the terminal to a standard one with minimal capabilities — this satisfies the program that complains about TERM
not being set.
Upvotes: 31