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

Re: stuff in ~/bin won't run



Dotan Cohen <dotancohen@gmail.com> wrote:
> Thanks, Mike. Actually, rather than be busy for hours, I do wish that
> there were some document that explains what gets run where, clearly. I
> have yet to find one.

Put these lines in your .bashrc and .bash_profile and you'll see what
gets run when

    # bashrc
    echo "Running bashrc: `date`" >>"$HOME/.bash.log"
    test -t 1 && echo "Running bashrc: `date`"

    # bash_profile
    echo "Running bash_profile: `date`" >>"$HOME/.bash.log"
    test -t 1 && echo "Running bash_profile: `date`"


What I find works for me is to put all the "run once" stuff into one file,
and all the "run each time I start a terminal" stuff in the other:

    # bashrc
    test -z "$DONE_ONCE" && . "$HOME/.bash_runonce"
    test -z "$DONE_EACH" && . $HOME/.bash_runeach"

    # bash_profile
    test -z "$DONE_ONCE" && . "$HOME/.bash_runonce"
    test -z "$DONE_EACH" && . $HOME/.bash_runeach"

    # bash_runonce
    export DONE_ONCE=true
    ...

    # bash_runeach
    DONE_EACH=true	# NB no "export"
    ...

Chris


Reply to: