[issue1397] jobs -l output inconsistency when called from script

Stathis Kamperis (via DragonFly issue tracker) sinknull at leaf.dragonflybsd.org
Sun Jun 7 10:51:45 PDT 2009


New submission from Stathis Kamperis <ekamperi at gmail.com>:

Salute.

The jobs(1) utility gives different output when called from a script and when
from an interactive shell.

[beket at voyager ~] cat testjobs.sh
#!/bin/sh
sleep 30 &
jobs -l
[beket at voyager ~] sh testjobs.sh 
[1] + 10005 Running           
[beket at voyager ~] sleep 30 &
[1] 10006
[beket at voyager ~] jobs -l
[1]+ 10006 Running                 sleep 30 &
[beket at voyager ~] 

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
the fields.

NetBSD 5.0:
$ sh testjobs.sh 
[1] + 27159 Running           sleep 30

SunOS 5.10:
tuxillo at solaris$ /usr/xpg4/bin/sh testjobs.sh 
[1] + 11754      Running                 <command unknown>

FreeBSD: same as us. (kindly reported by vstemen at #dragonflybsd).

Any thoughts ?

Best regards,
Stathis

----------
messages: 6733
nosy: Beket
priority: bug
status: deferred
title: jobs -l output inconsistency when called from script

_____________________________________________________
DragonFly issue tracker <bugs at lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue1397>
_____________________________________________________





More information about the Bugs mailing list