[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ‘command … &’ creates subshell

From: Eli Schwartz
Subject: Re: ‘command … &’ creates subshell
Date: Wed, 1 Jul 2020 07:54:05 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 7/1/20 6:24 AM, Robert Elz wrote:
>     Date:        Wed, 01 Jul 2020 00:43:14 +0300
>     From:        Dmitry Alexandrov <dag@gnui.org>
>     Message-ID:  <tuysgrgt.dag@gnui.org>
>   | > If you need to ensure a disk executable is used,
>   | Of course.  Why "command" otherwise?
> That doesn't actually work, "command" can run built-ins, there is
> actually no method (not even via use of "env") which guarantees
> execution of an executable from an external file, other than by
> using the complete path name (containing at least one '/') of the
> desired file.

Indeed -- that's why I specifically used the bashism $(type -P ...) as
type -P forces the printing of an external file executable.

Regarding use of env, I presume you're referring to the busybox behavior
here, where busybox's builtin env applet will still execute other
builtin applets.  That's the only case I'm aware of that will not
guarantee execution of an executable from an external file -- so
shouldn't env be safe to use as such, if you know:

a) your interpreter is bash rather than /bin/sh,
b) the external disk executable "env" is not a symlink to busybox

Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]