[offtopic] Re: [PLUG] .profile
Jonathan Sergent
sergent@ETLA.NET
Wed, 01 Sep 1999 21:01:22 -0700
BTW, this is off topic. I suggest that general Unix questions are
probably better off on the one or more of the purdue.* newsgroups.
/// HarleY <harley@quasar.ground.dynip.com>:
] I created my .profile in my home directory on expert.
] The problem is that most things are working like the umask ect, but
] I installed bash on expert and put it in my homedir. I put a line in my
] .profile that looks something like this
] ~/bash -l
] However bash doesn't exicute when I log in. I think it may have to do
] with the fact that bash isn't listed in /etc/shells. Is there a way
] around this? I'd really like bash as my default shell.
~/ does not work with /bin/sh. If your shell is /bin/sh, you will
need to say $HOME.
Also, you don't say "exec bash" and so once you exit bash, you will
get back to your normal shell before you log out.
And even worse, bash also reads .profile on startup, and this will
send it into a loop, starting lots of processes. Fortunately, you
have a per-user process limit on expert, or you could easily crash
a machine with this (bash is not small).
Suggestion: chsh to csh and then make a ".login" that says:
if ( "${TERM}" != "" ) then
setenv SHELL ${HOME}/bin/bash
exec ${HOME}/bin/bash -l
endif
This avoids the .profile problem since csh doesn't use it.
The problem with _this_ is that if you use rsh, your commands get run
by csh instead of an sh type shell, so some things won't work like they
should.
The setenv is important, or you may end up with csh for your subshells
instead of bash.
You can work this with some stuff in your .profile, but it tends to be
shell-dependent (i.e. different between bash and ksh) and system-dependent
(i.e. different between pdksh on Linux and ksh-88i on Solaris) to
determine whether the shell you are running in is a login shell or
a subshell of some sort. It's possible, but tricky, and limits you
from sharing your home directory and init files between architectures a
bit more. Personally, when I need to pull this kind of trick, I set my
login shell to csh and do a .login as above. You may need to fiddle a
bit more if you intend to use CDE from the account you do this to.
--jss.