su on 10.2: TERM: Undefined variable

Miroslav Lachman 000.fbsd at quip.cz
Mon Nov 23 00:15:24 UTC 2015


Erich Dollansky wrote on 11/23/2015 00:31:
> Hi,
>
> On Sun, 22 Nov 2015 14:04:25 +0100
> Miroslav Lachman <000.fbsd at quip.cz> wrote:
>
>>>
>>> Miroslav Lachman
>>
>> The only workaround I found is adding
>> export TERM=""
>> at the top of the script.
>>
> this is a bit strange. TERM should be always define to tell the
> applications the capabilities of your terminal. When X is running, it
> is normally set to xterm, if nothing is available - or you do not know
> what is available - set it to vt100.
>
> Of course, the best would be to find out why it is not set on your
> machine.

TERM is not set or is empty if script runs from crontab. I think this is 
normal. Michael's test didn't print value of $TERM too, but his su 
didn't complained about "Undefined variable".

If I run this script in ssh session it prints "screen", because I am 
using screen.

Miroslav Lachman


More information about the freebsd-stable mailing list