jobs -l output inconsistency when called from script
The jobs(1) utility gives different output when called from a script and when
from an interactive shell.
[beket@voyager ~] cat testjobs.sh
sleep 30 &
[beket@voyager ~] sh testjobs.sh
 + 10005 Running
[beket@voyager ~] sleep 30 &
[beket@voyager ~] jobs -l
+ 10006 Running sleep 30 &
It is not clear whether the jobs(1) should work at all inside a script. POSIX
says that since it doesn't fall into the 'special' built-in category a new
environment (subshell?) would be created upon its invocation. Even this is true,
the jobs aren't specific to the shell environment, so they should be visible to
jobs(1). And in any case, the command should either print nothing or print all
$ sh testjobs.sh
 + 27159 Running sleep 30
tuxillo@solaris$ /usr/xpg4/bin/sh testjobs.sh
 + 11754 Running <command unknown>
FreeBSD: same as us. (kindly reported by vstemen at #dragonflybsd).
Any thoughts ?