In article <[EMAIL PROTECTED]> you write: >I use a bash function file "/usr/local/bash_functions". In the >/etc/profile file there is a statement "source >/usr/local/bash_functions". I can normally use the bash fuctions when I >am in my /home/user directory but when I do an "su" I can no longer use >the bash_functions without resourcing them. This is very inconvenient. >What can I do so they stay sourced whether I am /home/user $ or su #? Is >there some place to put a source statement which will do the job? I have >tried source statements in /home/user and /root .bash_profile files as >well. Another of life's little mysteries.
If you look at the documentation for both su and bash you will find your problem: su by default does not start a login shell. This means that bash does not look in /etc/profile or ~/.bash_profile. Instead you need to add things to ~/.bashrc. Alternatively, using su with a - option will cause it to start a login shell so your normal profile will be read. bash(1): Login shells: On login (subject to the -noprofile option): if /etc/profile exists, source it. if ~/.bash_profile exists, source it, else if ~/.bash_login exists, source it, else if ~/.profile exists, source it. On exit: if ~/.bash_logout exists, source it. Non-login interactive shells: On startup (subject to the -norc and -rcfile options): if ~/.bashrc exists, source it. -- Steve McIntyre, CURS Secretary, Cambridge, UK. [EMAIL PROTECTED] CUWoCS Honorary Vice-Chair-Thing Cthulhu - Why vote for the Lesser Evil? "Can't keep my eyes from the circling sky, +------------------ "Tongue-tied & twisted, Just an earth-bound misfit, I..." |Finger for PGP key -- TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to [EMAIL PROTECTED] . Trouble? e-mail to [EMAIL PROTECTED]