Date: Wed, 04 Apr 2012 08:03:11 -0700 From: perryh@pluto.rain.com To: illoai@gmail.com Cc: questions@freebsd.org Subject: Re: current pids per tty Message-ID: <4f7c62af.TE2lRux2ew4%2BbRu8%perryh@pluto.rain.com> In-Reply-To: <CAHHBGkqw865mGPS-9PSBfFa9qOJO8wJcrsTvfr4aoxw%2B0EF9Eg@mail.gmail.com> References: <CAPkyVLzPuX3jxRRRVsJEtcYE%2B4kAaas50RuzbVByEUixuHhQdA@mail.gmail.com> <CAHHBGkqw865mGPS-9PSBfFa9qOJO8wJcrsTvfr4aoxw%2B0EF9Eg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
"illoai@gmail.com" <illoai@gmail.com> wrote: > (there is an executable named /usr/bin/jobs, but . . . > well run "cat /usr/bin/jobs" & see for yourself). Whoa! Does /usr/bin/jobs even work? $ cat /usr/bin/jobs #!/bin/sh # $FreeBSD: src/usr.bin/alias/generic.sh,v 1.2.10.1.4.1 2010/06/14 02:09:06 kensmith Exp $ # This file is in the public domain. builtin ${0##*/} ${1+"$@"} It looks as if generic.sh intends to have the same effect as the builtin matching the name under which the script is run, but at least for "jobs" I don't think it will DTRT because it will run in the wrong context: * The builtin "jobs" command will report all background jobs known to the shell in which it is issued. * Because it is a shebang script, running /usr/bin/jobs will cause the shell in which it is run to fork/exec an instance of /bin/sh, and that instance will execute the /usr/bin/jobs script, thus it will will be the new /bin/sh instance that executes _its_ builtin "jobs" command -- reporting nothing, since _that_ instance has not put anything into the background (and has no knowledge of what-all its parent shell may have put in the background).
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4f7c62af.TE2lRux2ew4%2BbRu8%perryh>