[comp.unix.questions] Exporting functions in ksh

chittamu@umvlsi.ecs.umass.edu (Satish Kumar .C) (11/17/89)

Does anyone know how to export function definitions to subshells. We
have a problem here in that we define a function is /etc/profile that
is required by most of the system users. But once the user starts up a
X-windows session and runs subshells in the xterm window, the function
is no longer visible. I know, "Add it to the users .kshrc or .profile"
The thing is we want to be able to modify the function without the
users knowing about the change(internal). So my question is, Is there
some way to export functions to subshells. Alias definitely can't be
exported. Any suggestions???
-- 
	-Satish.
	chittamu@cs.umass.edu
--
The Theory of Objectivity: E = mc++

samlb@pioneer.arc.nasa.gov (Sam Bassett RCD) (11/20/89)

	Off the top of my head, I'd say have your users pu the following
line in their .profile:

		. /etc/std.funcs

and define all of the stuff you want them to have in there.


Sam'l Bassett, Sterling Software @ NASA Ames Research Center, 
Moffett Field CA 94035 Work: (415) 694-4792;  Home: (415) 969-2644
samlb@well.sf.ca.us                     samlb@ames.arc.nasa.gov 
<Disclaimer> := 'Sterling doesn't _have_ opinions -- much less NASA!'

ekrell@hector.UUCP (Eduardo Krell) (11/20/89)

typeset -xf name

works for shell scripts only. If you want a new shell invocation
to inherit functions, you have to put them in your ENV file.

If you have the new (1988) ksh, you can set FPATH to a colon-separated
list of directories that ksh searches for auto-load functions. This
works like PATH does for command searching.
    
Eduardo Krell                   AT&T Bell Laboratories, Murray Hill, NJ

UUCP: {att,decvax,ucbvax}!ulysses!ekrell  Internet: ekrell@ulysses.att.com