Are there users of ash's "pathopts"? Do other shells have such a thing?

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

 



ash allows PATH to contain "%builtin" and "DIR%func"
pseudo-directories.

%builtin shows in what order builtins to be found
relative to searching directories for external commands.

DIR%func allows to have a directory of "auto-loadable" functions.
(dash git tree seems to have an example of it as src/funcs/*).

I tried a few searches on the internet and this feature
seems to be almost entirely not documented. I found exactly one
manpage documenting it:

https://www.unix.com/man-page/minix/1/ash/

    Path Search

       When locating a command, the shell first looks to see if it has a shell function by that name.  Then, if PATH does not contain an entry for
       "%builtin", it looks for a builtin command by that name.  Finally, it searches each entry in PATH in turn for the command.

       The value of the PATH variable should be a series of entries separated by colons.  Each entry consists of a directory name, or a  directory
       name followed by a flag beginning with a percent sign.  The current directory should be indicated by an empty directory name.

       If  no  percent	sign  is  present,  then  the entry causes the shell to search for the command in the specified directory.  If the flag is
       ``%builtin'' then the list of shell builtin commands is searched.  If the flag is ``%func'' then the directory is searched for a file which
       is read as input to the shell.  This file should define a function whose name is the name of the command being searched for.

Here is an example of a user having a problem because he has a PATH with
directory containing "GNU%2fLinux" string in its name:

https://unix.stackexchange.com/questions/126955/percent-in-path-environment-variable

So... maybe we can drop it?

I assume it's rarely (never?) used in the wild.
It interferes with valid directories with percents in names.
It's non-standard, and not a typical feature of other Bourne-like shells
  (maybe we (ash family) are the only ones?)
Code complication to support it is a chore.




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux