look up functions per PATH (%func)

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

 



Hello,

dash still implements the "%func" directory mechanism
as inherited from the original Almquist shell. The shell
searches directories which are flagged with a trailing
"%func" for functions in files with corresponding names:

Let the non-executable file /tmp/myfunction contain
"myfunction(){ echo my function;}"

->  $ PATH=$PATH:/tmp%func  dash
    $ type myfunction
    myfunction is a shell function
    $ myfunction
    my function

The filename must correspond, so that the shell can initially
find a definition; but then all functions from that file are
available.  "%builtin" is the counterpart to make a built-in
override a function again.


With 4.4BSD-Alpha '92, this was removed from the manual, when
it was completely rewritten (starting to implement POSIX).
The code remained untouched, though.  In fact, it seems that
even to date all commonly known ash variants - even busybox -
still implement it.  So it's a rare (if not the only) feature,
for which an almquist shell can be actively tested, that is,
not just by eliminating other shells.  My nostalgic side even
regrets that it is likely to get removed as non-POSIX feature :)

Has anybody ever met scripts making use of this?
Do you know more interesting facts about this?


Cheers, Sven
-- 
http://www.in-ulm.de/~mascheck/various/ash/
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

  Powered by Linux