Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove "TERM environment variable not set"

Tags:

bash

shell

cron

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..?

like image 802
rohini Avatar asked Oct 17 '13 11:10

rohini


People also ask

How do I unset an environment variable?

To unset an environment variable from Command Prompt, type the command setx variable_name “”. For example, we typed setx TEST “” and this environment variable now had an empty value.

Which command can be used to remove an environmental variable?

The dsadmin command can be used for deleting an environment variable in a particular project.


1 Answers

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.

like image 100
Jonathan Leffler Avatar answered Sep 19 '22 12:09

Jonathan Leffler