TERM environment variable not set

前端 未结 4 393
花落未央
花落未央 2020-12-01 05:14

I have a file.sh with this, when run show : TERM environment variable not set.

smbmount //172.16.44.9/APPS/Interfas/HERRAM/sc5 /mnt/siscont5 -o 
iocharset=ut         


        
4条回答
  •  [愿得一人]
    2020-12-01 05:33

    You've answered the question with this statement:

    Cron calls this .sh every 2 minutes

    Cron does not run in a terminal, so why would you expect one to be set?

    The most common reason for getting this error message is because the script attempts to source the user's .profile which does not check that it's running in a terminal before doing something tty related. Workarounds include using a shebang line like:

    #!/bin/bash -p

    Which causes the sourcing of system-level profile scripts which (one hopes) does not attempt to do anything too silly and will have guards around code that depends on being run from a terminal.

    If this is the entirety of the script, then the TERM error is coming from something other than the plain content of the script.

提交回复
热议问题