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"



On Sun, Sep 22, 2024 at 06:58:25PM +0700, Robert Elz wrote:
>     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

As for EDITOR, or others, the trick is to use "command -v" when
setting the variable.

xargs $(command -v bar/foo) ...

It's a limited addition, that can be useful 90% of the time. For the 10
remaining percents, it is as usual: a limited bonus for a significant
code modification.

I will start by the simplest.
-- 
        Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index