Re: .bashrc not executed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Jérôme Bove wrote:
> I'd like to edit my .bashrc file. So i edit it (vi /home/user/.bashrc)
> and save. When I open X-Terminal or connect via ssh to user (not root),
> the bashrc is not executed.
> If I do su user, then bashrc is executed.
> I installed bash and edit my /etc/passwd file for user to use bash.
> What should I do for bashrc to be executed ?

To develop on what Alejandro said, when bash starts, it reads the
following, in this order:

(some approximate definitions: a login shell is when you start bash from
a login prompt, an interactive shell is when you're able to run commands
interactively, as opposed to starting bash for a shell script)

If bash is started as an interactive login shell:
 * Read and execute /etc/profile (if the file exists)
 * Search for ~/.bash_profile, ~/.bash_login, ~/.profile in that order
and read and execute the first one it finds

When a login shell exits:
 * Read and  execute ~/.bash_logout, if it exists.

If started as an interactive, non-login shell (eg. run directly as
/bin/bash):
 * Read and execute /etc/bash.bashrc and ~/.bashrc, if they exist.

If started  non-interactively in a shell script:
 * Expand BASH_ENV environment variable, and read and execute the file
in it, if it exists

According to the Bash manpage, if started from a network log-in:
 * Read and execute /etc/bash.bashrc and ~/.bashrc, if they exist.

I just tested, for an SSH-launched shell, only .bash_profile got run for
me, not .bashrc


Here on my laptop, the default .bash_profile contains

if [ -f ~/.bashrc ]; then
  . ~/.bashrc;
fi

which basically says that .bashrc will get executed for every login
shell, as well as non-login shells.

Cheers,
Dave.


-- 
maemo.org docsmaster
Email: dneary@xxxxxxxxx
Jabber: bolsh@xxxxxxxxxx

_______________________________________________
maemo-users mailing list
maemo-users@xxxxxxxxx
https://lists.maemo.org/mailman/listinfo/maemo-users



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Big List of Linux Books]    

  Powered by Linux