SUSv4 TC1 describes the "." (dot) command thus:

  The shell shall execute commands from the file in the current
  environment.

  If file does not contain a <slash>, the shell shall use the
  search path specified by PATH to find the directory containing
  file. Unlike normal command search, however, the file searched
  for by the dot utility need not be executable. If no readable
  file is found, a non-interactive shell shall abort; an
  interactive shell shall write a diagnostic message to standard
  error, but this condition shall not be considered a syntax
  error.

This makes it easy to write code which works by default, fails
hard and fast, and is configurable at runtime using $PATH.

Now, let's say I have a library of shell functions, and I want
the usage instructions and manpage synopsis to be simple:

  . mylib.sh
  mylib_this ...
  mylib_that ...

The Makefile installs mylib.sh into $(prefix)/bin (0644) so
`. mylib.sh` finds it rather by default.

Is it ok to install mylib.sh into /usr/bin in this way?
The standard[0] does not explicitely proscribe it, yet the wording
"directory of executable commands" has lead a colleague of mine to
conclude that *only* executable commands are permitted there.

I see that such a stance would neuter a major feature of an important
standard utility *and* introduce artificial makework for packagers,
so I doubt this is the correct reading.

Which interpretation is correct?

[0] 
https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#usrbinMostUserCommands

-- 
roman
_______________________________________________
fhs-discuss mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fhs-discuss

Reply via email to