su on 10.2: TERM: Undefined variable

Michael B. Eichorn ike at michaeleichorn.com
Sat Nov 21 20:42:17 UTC 2015


On Sat, 2015-11-21 at 13:31 +0100, Miroslav Lachman wrote:
> I noticed some weird behavior of "su" command in shell scripts
> running 
> from cron after upgrade from FreeBSD 8.4 to 10.2.
> 
> If I have this in script
> 
> su -m www -c 'ls -l'
> 
> then I get "TERM: Undefined variable" on the stderr if this script is
> run from cron.
> It works fine on FreeBSD 8.4
> 
> Is it intentional behavior?
> 
> Miroslav Lachman

I cannot reproduce your problem. I used the following script:

#!/bin/sh

echo "BEGIN TEST"
echo $TERM

su -m www -c 'ls -l'

echo $TERM
echo "END TEST"

crontab is:
*	*	*	*	*	/root/test.sh

and the result is:

BEGIN TEST

total 520765
-rw-r--r--   1 root  wheel  724002816 Aug 12 11:45 FreeBSD-10.2-
RELEASE-amd64-disc1.iso
-rwxr-xr-x   1 root  wheel         90 Nov 21 15:33 test.sh

END TEST

# freebsd-version
10.2-RELEASE-p7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5729 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20151121/b9c67571/attachment.bin>


More information about the freebsd-stable mailing list