tech-userlevel archive

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

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



    Date:        Sun, 22 Sep 2024 13:13:19 +0200
    From:        tlaronde%kergis.com@localhost
    Message-ID:  <Zu_7z64HGi7fZn_j%kergis.com@localhost>

  | 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



Home | Main Index | Thread Index | Old Index