Re: sh(1): POSIX "Command Search and Execution"

Robert Elz <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
    Date:        Sun, 22 Sep 2024 13:13:19 +0200
    From:        [email protected]
    Message-ID:  <[email protected]>

  | No: just the shell. Putting this in a C source will not be portable,
  | since the shell used for system(3) would not mandatorily understand
  | a "set -o xfilename" or whatever the name for the option.

No, there would need to be some other mechanism, probably an environment
var (like -o posix, and POSIXLY_CORRECT) to enable it in other functions.

But if you're not going to be able to have "xargs foo/bar" work, or
set EDITOR to foo/bar and have that work, then I don't think any of
this belongs inside sh either - everything that you need at sh command
level can be provided by functions -- including PATH searches - and just
about as fast as the shell would do it, as most of the time there is
spent reading directories, and checking for the existence of file names
within them (test -x)) which is going to be essentially the same either
way.

kre
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.