We help IT Professionals succeed at work.

using .profile in bash on solaris 7

gadh98 asked
i want my shell to be bash, and i did success on that, but the .profile file is not processed on login.
i need to execute it by " source ~/.profile" command.

where can i put .profile contents in order to run them automatically on login ?

(also in telnet login)

Watch Question

Put the startup commands in your .bashrc file.
Top Expert 2005

Create a ~/.bash_profile containing those items that are in your ~/.profile. Just remember that .bash_profile is only executed by the login shell. So commands that you want executed in subsequent shells (like an xterm) need to be in ~/.bashrc.

man bash (section INVOCATION):

       When  bash is invoked as an interactive login shell, or as
       a non-interactive shell with the --login option, it  first
       reads and executes commands from the file /etc/profile, if
       that file exists.  After reading that file, it  looks  for
       ~/.bash_profile,  ~/.bash_login,  and  ~/.profile, in that
       order, and reads and executes commands from the first  one
       that  exists  and is readable.  The --noprofile option may
       be used when the shell is started to inhibit  this  behav-

       When a login shell exits, bash reads and executes commands
       from the file ~/.bash_logout, if it exists.

       When an interactive shell that is not  a  login  shell  is
       started,  bash reads and executes commands from ~/.bashrc.

But keep in mind that this behaviour might be changed when compiling bash. Also check what realy is you login shell in /etc/passwd.


thanks alot !

Explore More ContentExplore courses, solutions, and other research materials related to this topic.