bug-bash
[Top][All Lists]
Advanced

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

Re: bash 4.2 breaks source finding libs in lib/filename...


From: Steven W. Orr
Subject: Re: bash 4.2 breaks source finding libs in lib/filename...
Date: Sat, 03 Mar 2012 14:17:38 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.27) Gecko/20120216 Thunderbird/3.1.19


It could be even furthermore separated from the traditional "source" and a
new keyword introduced like "require" a la lisp which would be able to do
things like:

1) load the file, searching in the BASH_LIB_PATH (or other variables) for a
file with optionally the extension .sh or .bash
2) only load the file if the "feature" as not been provided, eg only load
the file once
3) maybe optionally only load the definition and not execute commands
(something I've seen people asking for on several occasions on IRC), for
instance that would allow to have test code inside the lib file or maybe
print a warning that it's a library not to be executed. (No so important
imo)

I think this would benefit the bash_completion project and help them to
split the script so that the completion are only loaded on demand.
(one of the goal mentionned at http://bash-completion.alioth.debian.org/ is
"make bash-completion dynamically load completions")
My understanding is that the
http://code.google.com/p/bash-completion-lib/project did something
like this but that it was not  working entirely as
they wanted.
(I hope some of the devs reads this list)

On the other hand, there is the possibility to add FPATH and autoload like
in ksh93 ...
I haven't think to much about it but my guess is that it would really be
easy to implement a module system with that.

my 2 cents....as I don't have piles of bash lib.

Ksh uses the FPATH variable to find things that are sourced in. I found a great package written decades ago by Noah Friedman. I now use it as an integral part of my bash environment. His package uses FPATH to satisfy a 'require' command and each module that can be required has a set of provide statements so you can just require what you need.

No need to enhance bash at all.

--
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]