如何删除" TERM环境变量未设置" [英] how to remove "TERM environment variable not set"

查看:335
本文介绍了如何删除" TERM环境变量未设置"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本runonce.sh谁通过的cron调用另一个脚本setup.sh。我们认为这种情况下,其中理想的情况下没有设置TERM环境变量。被认为是在runonce.sh脚本的输出。

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.

现在我面临的另一个第三简单的脚本问题 - upgradeAndTest.sh来电时为setup.sh,那个时候也是TERM环境变量未设置。被认为是在upgradeAndTest.sh脚本的输出。为何如此..?

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

另外,如果我在调用脚本,然后重定向也向setup.sh的标准输出标准错误TERM环境变量未设置。显示在控制台上。

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

推荐答案

运行程序,它通过的cron 要求一个终端可能导致的问题;它不会有一个终端,当它是由的cron 运行。

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}

如果环境变量 TERM 已设置,这是一个空操作。如果不是,它设置终端一个标准用最少的能力 - 这是满足抱怨节目 TERM 未设置

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.

这篇关于如何删除" TERM环境变量未设置"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆