Re: .bashrc not executed

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

 



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@xxxxxxxxx> 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@xxxxxxxxx
> Jabber: bolsh@xxxxxxxxxx
>
> _______________________________________________
> maemo-users mailing list
> maemo-users@xxxxxxxxx
> https://lists.maemo.org/mailman/listinfo/maemo-users
>
_______________________________________________
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