On Tue, Oct 02, 2007 at 10:57:16AM -0600, Bob Proulx wrote: > Stephane Chazelas wrote: > > To work around that, you have to do things like this in > > /etc/profile: > > ... > > And do something similar in your ~/.profile for your ~/.bashrc. > > While that is normal to do to configure interactive sessions the > original question was where should shell functions be placed for use > by scripts. I think the above answer is a good answer but to a > different question. [...]
Oops, I had indeed missed that important part of the discussion, you're completely right. However note that the file pointed to by the BASH_ENV environment variable is sourced even by non-interactive shells (as long as bash is not called as "sh" or with --posix or with POSIXLY_CORRECT or SHELLOPTS=posix in its environment) So, putting function definitions in /some/file will make those function available to all non-posix bash instances that receive BASH_ENV=/some/file in their environment. Now, I'd agree with you you probably don't want to do that, and the most sensible thing is to source your shell function library file from your script. -- Stéphane