Visit The New, Modern Unix Linux Community

Function Libraries using FPATH

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Function Libraries using FPATH
# 1  
Function Libraries using FPATH

At our site we have a function library that contains several functions that are called via FPATH. We're using ksh and have environment variables in our .profile that link us to these as follows:

export CIRC_LIB=/apps/usr/circ/circ_lib

My questions are: When are the functions loaded? At login? Are they some how cached?

The reason I'm asking is that is seem as though unless one logs out and back on newer, or changed, versions of these functions don't work properly.

Perhaps someone can point me to some information on this. Thanks, in advance, for any assistance.
# 2  
If the FPATH functions are invoked during login they remain in memory unchanged.
You do have to log out and back in again -- in this case.

alias is a better way of handling the problem - assuming these functions change often.
# 3  
You can "unset -f" to lose the old definition. I think this also removes the autoload attribute, so if they were autoloaded, you might need to reset that.
# 4  
I often reload the .profile by (ksh syntax):

. $HOME/.profile

This is done with some other shells by:

source $HOME/.profile

You might need a different path.

Greetings, William.
# 5  
unset -f does clear the functions from memory. I thought he meant that the function declarations were in /etc/profile. Depending on what's in that file, simply rerunning it may trash the PATH variable and other settings.

We tell users just to logout & then login. That way there's less chance for problems.
Especially if the functions are updated only rarely.

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #279
Difficulty: Easy
A microkernel is the near-minimum amount of software that can provide the mechanisms needed to implement an operating system (OS). These mechanisms include low-level address space management, thread management, and inter-process communication (IPC).
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Function - Make your function return an exit status

Hi All, Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition. #Body function1() { if then echo "exist" else echo "not exist" } #if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies

2. Shell Programming and Scripting

Bash FPATH code update

In this post at 302451613-post2.html the link to the code comes up not found. The thread is closed, so I was unable to ask on the thread itself and I do not have enough posts yet to send a private message (or write out a proper html link). Does the author (jim mcanamara) have an updated link? ... (2 Replies)
Discussion started by: matthewpersico
2 Replies

3. Shell Programming and Scripting

Emulate ksh's FPATH variable in bash

Over time i have developed a library of useful (ksh) functions which i use in most of my scripts. I use the ksh's FPATH variable to locate all these functions and use a standard environment-setting-function to always have the same environment in all my scripts. Here is how i begin scripts: ... (3 Replies)
Discussion started by: bakunin
3 Replies

4. Programming

I want to know some c libraries

I'm a rookie to C and i'm looking for some libraries to learn,something likes the C++ STL or Boost ,does any1 can tell me some of them?Thanks a lot:) Eric (3 Replies)
Discussion started by: homeboy
3 Replies

5. Shell Programming and Scripting

How to use two different libraries?

Hello, I need to use two different libraries like /usr/local/bin/expect and /usr/bin/ksh at the same script. Is it possible? (4 Replies)
Discussion started by: fozay
4 Replies

6. Shell Programming and Scripting

Passing global variable to a function which is called by another function

Hi , I have three funcions f1, f2 and f3 . f1 calls f2 and f2 calls f3 . I have a global variable "period" which i want to pass to f3 . Can i pass the variable directly in the definition of f3 ? Pls help . sars (4 Replies)
Discussion started by: sars
4 Replies

7. UNIX for Dummies Questions & Answers


I am slowly ploughing my way through the list of links to on-line tutorials you provided to newbies. I for one am grateful for such a comprehensive list, so first of all thank you for that. What i cannot seem to find, is information on C++ libraries: The two links on libraries in your list... (0 Replies)
Discussion started by: pil888
0 Replies

8. IP Networking


How is Libnet and libpcap are useful in sending a packet through DLL layer and sniff network layer? and how sinffers are used to track ip adresses provided Mac adresses? (1 Reply)
Discussion started by: netsavy
1 Replies

9. Programming

C Libraries??

I can not locate package sys/mkdev.h on HP-UX or Linux. Is it a special package or something? (9 Replies)
Discussion started by: laila63
9 Replies

10. UNIX for Dummies Questions & Answers

Using FPATH and PATH together

If you specify the same directory in your FPATH and PATH variables, and you type in a "command" (e.g. hello), and there exists a file called hello in that common directory, will the shell first attempt to interpret this file as a function, and failing this, then re-attempt to interpret it as a... (2 Replies)
Discussion started by: DeMented
2 Replies

Featured Tech Videos