.bashrc not executed
.bashrc not executed
Re: .bashrc not executed
2010-06-23 11:54 UTC
Jérôme Bove wrote:
> HI !
> 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 ?
> Thanks
Hi Jérôme,
.bashrc is only read by non-interactive logins. Try renaming it to .bash_profile .
Alejandro.
> HI !
> 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 ?
> Thanks
Hi Jérôme,
.bashrc is only read by non-interactive logins. Try renaming it to .bash_profile .
Alejandro.
Re: .bashrc not executed
2010-06-23 14:57 UTC
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@maemo.org
Jabber: bolsh@jabber.org
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@maemo.org
Jabber: bolsh@jabber.org
Re: .bashrc not executed
2010-06-23 16:38 UTC
I have a similar issue.
I put some environment variables and an alias in the .profile.
this worked, so I was playing with vim to get familiar and so I took
what I saw in my /root/.profile file and try to put it in my .profile.
basically the:
include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
and moved my alias and environment variables to my new .bashrc
# go environment variables
. /opt/go/bin/go_profile
# Aliases
alias wksp='cd;cd $HOME/MyDocs/Workspace'
But this didn't work. I get a:
-sh: : not found
and have no variables nor aliases.
f(t)
On 6/23/10, Dave Neary <dneary@maemo.org> wrote:
> 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@maemo.org
> Jabber: bolsh@jabber.org
>
>
I put some environment variables and an alias in the .profile.
this worked, so I was playing with vim to get familiar and so I took
what I saw in my /root/.profile file and try to put it in my .profile.
basically the:
include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
and moved my alias and environment variables to my new .bashrc
# go environment variables
. /opt/go/bin/go_profile
# Aliases
alias wksp='cd;cd $HOME/MyDocs/Workspace'
But this didn't work. I get a:
-sh: : not found
and have no variables nor aliases.
f(t)
On 6/23/10, Dave Neary <dneary@maemo.org> wrote:
> 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@maemo.org
> Jabber: bolsh@jabber.org
>
>
Re: .bashrc not executed
2010-06-23 16:43 UTC
On Wed, Jun 23, 2010 at 01:38:41PM -0300, Francisco Diaz Trepat - gmail wrote:
> I have a similar issue.
>
> I put some environment variables and an alias in the .profile.
>
> this worked, so I was playing with vim to get familiar and so I took
> what I saw in my /root/.profile file and try to put it in my .profile.
> basically the:
>
> include .bashrc if it exists
> if [ -f "$HOME/.bashrc" ]; then
> . "$HOME/.bashrc"
> fi
>
> # set PATH so it includes user's private bin if it exists
> if [ -d "$HOME/bin" ] ; then
> PATH="$HOME/bin:$PATH"
> fi
>
> and moved my alias and environment variables to my new .bashrc
>
> # go environment variables
> . /opt/go/bin/go_profile
>
> # Aliases
> alias wksp='cd;cd $HOME/MyDocs/Workspace'
>
> But this didn't work. I get a:
> -sh: : not found
^
This here is a <U+00A0> NO-BREAK SPACE character. Please find it in
your .profile/.bashrc/whatever and replace it with an ordinary ASCII space.
Hint:
> if [ -f "$HOME/.bashrc" ]; then
> . "$HOME/.bashrc"
^- it's here
Marius Gedminas
--
I dont know about madness (and anyway, the little green martians dancing
around me tell me not to worry...), but I've implemented something not
unlike this just now.
-- Peter Sabaini
> I have a similar issue.
>
> I put some environment variables and an alias in the .profile.
>
> this worked, so I was playing with vim to get familiar and so I took
> what I saw in my /root/.profile file and try to put it in my .profile.
> basically the:
>
> include .bashrc if it exists
> if [ -f "$HOME/.bashrc" ]; then
> . "$HOME/.bashrc"
> fi
>
> # set PATH so it includes user's private bin if it exists
> if [ -d "$HOME/bin" ] ; then
> PATH="$HOME/bin:$PATH"
> fi
>
> and moved my alias and environment variables to my new .bashrc
>
> # go environment variables
> . /opt/go/bin/go_profile
>
> # Aliases
> alias wksp='cd;cd $HOME/MyDocs/Workspace'
>
> But this didn't work. I get a:
> -sh: : not found
^
This here is a <U+00A0> NO-BREAK SPACE character. Please find it in
your .profile/.bashrc/whatever and replace it with an ordinary ASCII space.
Hint:
> if [ -f "$HOME/.bashrc" ]; then
> . "$HOME/.bashrc"
^- it's here
Marius Gedminas
--
I dont know about madness (and anyway, the little green martians dancing
around me tell me not to worry...), but I've implemented something not
unlike this just now.
-- Peter Sabaini
Re: .bashrc not executed
2010-06-23 18:23 UTC
Thanks Marius.
Graceful LOL@hit :-)
On Wed, Jun 23, 2010 at 1:43 PM, Marius Gedminas <marius@pov.lt> wrote:
> On Wed, Jun 23, 2010 at 01:38:41PM -0300, Francisco Diaz Trepat - gmail
> wrote:
> > I have a similar issue.
> >
> > I put some environment variables and an alias in the .profile.
> >
> > this worked, so I was playing with vim to get familiar and so I took
> > what I saw in my /root/.profile file and try to put it in my .profile.
> > basically the:
> >
> > include .bashrc if it exists
> > if [ -f "$HOME/.bashrc" ]; then
> > . "$HOME/.bashrc"
> > fi
> >
> > # set PATH so it includes user's private bin if it exists
> > if [ -d "$HOME/bin" ] ; then
> > PATH="$HOME/bin:$PATH"
> > fi
> >
> > and moved my alias and environment variables to my new .bashrc
> >
> > # go environment variables
> > . /opt/go/bin/go_profile
> >
> > # Aliases
> > alias wksp='cd;cd $HOME/MyDocs/Workspace'
> >
> > But this didn't work. I get a:
> > -sh: : not found
> ^
> This here is a <U+00A0> NO-BREAK SPACE character. Please find it in
> your .profile/.bashrc/whatever and replace it with an ordinary ASCII space.
>
> Hint:
>
> > if [ -f "$HOME/.bashrc" ]; then
> > . "$HOME/.bashrc"
> ^- it's here
>
> Marius Gedminas
> --
> I dont know about madness (and anyway, the little green martians dancing
> around me tell me not to worry...), but I've implemented something not
> unlike this just now.
> -- Peter Sabaini
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iD8DBQFMIjm6kVdEXeem148RAtiOAJ9FYKE6qKXco44/xRia7nwnShvtUgCdEJJS
> GF0wpmB1YC05/8xhZ3suvBI=
> =QByq
> -----END PGP SIGNATURE-----
>
>
>
Graceful LOL@hit :-)
On Wed, Jun 23, 2010 at 1:43 PM, Marius Gedminas <marius@pov.lt> wrote:
> On Wed, Jun 23, 2010 at 01:38:41PM -0300, Francisco Diaz Trepat - gmail
> wrote:
> > I have a similar issue.
> >
> > I put some environment variables and an alias in the .profile.
> >
> > this worked, so I was playing with vim to get familiar and so I took
> > what I saw in my /root/.profile file and try to put it in my .profile.
> > basically the:
> >
> > include .bashrc if it exists
> > if [ -f "$HOME/.bashrc" ]; then
> > . "$HOME/.bashrc"
> > fi
> >
> > # set PATH so it includes user's private bin if it exists
> > if [ -d "$HOME/bin" ] ; then
> > PATH="$HOME/bin:$PATH"
> > fi
> >
> > and moved my alias and environment variables to my new .bashrc
> >
> > # go environment variables
> > . /opt/go/bin/go_profile
> >
> > # Aliases
> > alias wksp='cd;cd $HOME/MyDocs/Workspace'
> >
> > But this didn't work. I get a:
> > -sh: : not found
> ^
> This here is a <U+00A0> NO-BREAK SPACE character. Please find it in
> your .profile/.bashrc/whatever and replace it with an ordinary ASCII space.
>
> Hint:
>
> > if [ -f "$HOME/.bashrc" ]; then
> > . "$HOME/.bashrc"
> ^- it's here
>
> Marius Gedminas
> --
> I dont know about madness (and anyway, the little green martians dancing
> around me tell me not to worry...), but I've implemented something not
> unlike this just now.
> -- Peter Sabaini
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iD8DBQFMIjm6kVdEXeem148RAtiOAJ9FYKE6qKXco44/xRia7nwnShvtUgCdEJJS
> GF0wpmB1YC05/8xhZ3suvBI=
> =QByq
> -----END PGP SIGNATURE-----
>
>
>
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 ?
Thanks