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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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. |
| |||
| 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 |
| ||||
| 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 |