[oclug] .bash_profile scripting

Walt Sullivan walt at trytel.com
Thu Nov 18 13:41:40 EST 2004


Hmmm, check the permission on .bash_profile. The last time I was lost
in the maze of profiles and *rc files, I resorted to adding a line in
each file, like:

export .bashrc_time=`date`

(changing the name for each file, of course). This let me know the
last time each file was invoked, and gave me a hint as to the order. 

I solved my problem, and commented out the debug lines, sigh, so I
can't show you example results.

Walt

Quoting Matt R <robineau at gmail.com>:
> The reason I used those statements was because the only example I had
> was the /etc/profile (which I also tried to edit just the export
> portions and still doesn't work). I also want a customised prompt, so
> if \$ will display x for root and & for normal users then i'll use
> that, otherwise...
> 
> To load the profile, I `source .bash_profile` (or /etc/profile). It
> works if I su to root, then source .bash_profile, but as soon as I get
> back to regular user, it stops working. Maybe I should also mention
> that I'm going to root using `su`.
> 
> Matt
> 
> 
> On Thu, 18 Nov 2004 12:36:12 -0500, Walt Sullivan <walt at trytel.com> wrote:
> > Why not let bash do it for you? Drop the whole if..then..fi, and use
> > \$ in your prompt. From the bash man page:
> > 
> >  \$     if the effective UID is 0, a #, otherwise a $
> > 
> > Also, when testing your .bash_profile, are you doing:
> > 
> > . ./.bash_profile
> > 
> > You should be. Simply doing
> > 
> > ./.bash_profile
> > 
> > doesn't change the invoking shell's environment.
> > 
> > Walt
> > 
> > Quoting Matt R <robineau at gmail.com>:
> > > No effect. I still get the same result.
> > >
> > 
> > 
> > --
> > Walt Sullivan                           /"\
> > UNIX & Networks, Security & SysAdmin    \ /
> > walt at trytel.com                          X  ASCII RIBBON CAMPAIGN
> >                                         / \ AGAINST HTML MAIL
> >                             See http://www.expita.com/nomime.html
> > 
> >

-- 
Walt Sullivan                           /"\                      
UNIX & Networks, Security & SysAdmin    \ /                      
walt at trytel.com                          X  ASCII RIBBON CAMPAIGN
                                        / \ AGAINST HTML MAIL
                            See http://www.expita.com/nomime.html

				



More information about the OCLUG mailing list