Unix Technical Forum

bash and .profile

This is a discussion on bash and .profile within the AIX Operating System forums, part of the Unix Operating Systems category; --> I administer a number of AIX servers in a corporate environment. I've recently converted to using bash as my ...


Go Back   Unix Technical Forum > Unix Operating Systems > AIX Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-05-2008, 10:30 AM
Steve
 
Posts: n/a
Default bash and .profile

I administer a number of AIX servers in a corporate environment. I've
recently converted to using bash as my personal login shell, but root
is and always has been defined with ksh as its default shell. I can
use "sudo su -" to get to root, and then execute bash, or I can "sudo
su - root -c bash", which does essentially the same thing in a single
command.

The problem: There are a few aliases and variables I'd like to
automatically customize for my bash environment when running as root,
but I don't know how to do it. Firing up bash in this way does not
seem to execute a .bash_profile. When I check my environment
variables, $SHELL is still set to ksh, so I can't use if/then/else
logic in .profile. Redefining the root account to use bash is not an
option, as I am not the only one with root access.

BTW, I typically login to a command line via PuTTY (SSH). No
X-Windows.

Any help would be greatly appreciated. Thanks.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-05-2008, 10:30 AM
miles
 
Posts: n/a
Default Re: bash and .profile


Steve wrote:
> I administer a number of AIX servers in a corporate environment. I've
> recently converted to using bash as my personal login shell, but root
> is and always has been defined with ksh as its default shell. I can
> use "sudo su -" to get to root, and then execute bash, or I can "sudo
> su - root -c bash", which does essentially the same thing in a single
> command.
>
> The problem: There are a few aliases and variables I'd like to
> automatically customize for my bash environment when running as root,
> but I don't know how to do it. Firing up bash in this way does not
> seem to execute a .bash_profile. When I check my environment
> variables, $SHELL is still set to ksh, so I can't use if/then/else
> logic in .profile. Redefining the root account to use bash is not an
> option, as I am not the only one with root access.
>
> BTW, I typically login to a command line via PuTTY (SSH). No
> X-Windows.
>
> Any help would be greatly appreciated. Thanks.


I ran the the commands below and it seems to do what you want. But I
had to use /.bashrc:

cws_sp:/>sudo /usr/bin/ksh
cws_sp:/>su -
root@cws_sp:/>bash
running bash .bashrc
root@cws_sp:/>

Miles

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-05-2008, 10:30 AM
Steve
 
Posts: n/a
Default Re: bash and .profile

Creating a .bashrc seems to have done the trick. .bash_profile appears
to be ignored no matter what I do.

Thanks,
Steve

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-05-2008, 10:30 AM
Laurenz Albe
 
Posts: n/a
Default Re: bash and .profile

Steve <sbassle@ayecontractor.com> wrote:
> I can
> use "sudo su -" to get to root, and then execute bash, or I can "sudo
> su - root -c bash", which does essentially the same thing in a single
> command.
>
> The problem: There are a few aliases and variables I'd like to
> automatically customize for my bash environment when running as root,
> but I don't know how to do it. Firing up bash in this way does not
> seem to execute a .bash_profile.


..bash_profile is only read by login shells, as the bash man page tells you.

Start bash with the -l flag.

Yours,
Laurenz Albe
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:17 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com