2012-03-31 7 views
3

Ich habe scala in meiner .bashrc-Datei hinzugefügt, aber wenn ich meinen Mac abschalte und wieder einschalte, findet er ihn nicht. Wenn ichSollte die .bashrc im Home-Verzeichnis automatisch geladen werden?

source ~/.bashrc 

tun, ist alles wieder normal. Ich würde sagen, das Problem ist mit der ganzen Datei im Allgemeinen, aber das Problem ist, habe ich andere Dinge drin, die vorher gut funktioniert haben, aber das Problem ist hartnäckig mit Scala. Wer weiß, warum das so ist und warum ich das Problem bekomme? Dies ist, was in meinem .bashrc-Datei, die richtig rvm und mysql läuft, aber nicht scala:

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting 
export PATH="/usr/local/mysql/bin:$PATH" 
export PATH="/Users/Zeroe/scala-2.9.1-1/bin:$PATH" 
+2

See [hier] (http://apple.stackexchange.com/questions/12993/why-doesnt-bashrc-run-automatically). – ughoavgfhw

+0

Hmm, vielen Dank für den Link. Ich werde es versuchen, wenn ich eine Chance bekomme. Definitiv als Antwort, damit ich es akzeptieren kann, wenn es funktioniert. – Andy

Antwort

6

Ihre Schale ist wahrscheinlich eine Login-Shell, in welchem ​​Fall bash verschiedene Profildateien, um lesen:

  1. /etc/profile
  2. ~/.bash_profile
  3. ~/.bash_login
  4. ~/.profile

Es ist typisch, ~/.bashrc aus einer dieser Dateien zu liefern, so dass Sie die gleiche Konfiguration für Login-Shells erhalten.

Dies ist, was mein ~/.profile enthält:

# ~/.profile: executed by the command interpreter for login shells. 
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login 
# exists. 
# see /usr/share/doc/bash/examples/startup-files for examples. 
# the files are located in the bash-doc package. 

# the default umask is set in /etc/profile; for setting the umask 
# for ssh logins, install and configure the libpam-umask package. 
#umask 022 

# if running bash 
if [ -n "$BASH_VERSION" ]; then 
    # include .bashrc if it exists 
    if [ -f "$HOME/.bashrc" ]; then 
    . "$HOME/.bashrc" 
    fi 
fi 

# set PATH so it includes user's private bin if it exists 
if [ -d "$HOME/bin" ] ; then 
    PATH="$HOME/bin:$PATH" 
fi 
export LANGUAGE="en_US:en" 
export LC_MESSAGES="en_US.UTF-8" 
export LC_CTYPE="en_US.UTF-8" 
export LC_COLLATE="en_US.UTF-8" 
26

ich dieses Diagramm von echo "${BASH_SOURCE[0]}" zu diesen Skripten heraus hinzufügen.

     +-----------------+ +------FIRST-------+ +-----------------+ 
        |     | | ~/.bash_profile | |     | 
login shell -------->| /etc/profile |-->| ~/.bash_login ------>| ~/.bashrc  | 
        |     | | ~/.profile  | |     | 
        +-----------------+ +------------------+ +-----------------+ 
        +-----------------+ +-----------------+ 
        |     | |     | 
interactive shell -->| ~/.bashrc -------->| /etc/bashrc  | 
        |     | |     | 
        +-----------------+ +-----------------+ 
        +-----------------+ 
        |     | 
logout shell ------->| ~/.bash_logout | 
        |     | 
        +-----------------+ 

Hinweis

  1. []-->[] bedeutet source by workflow (automatisch).
  2. [--->[] bedeutet source by convention (manuell. Wenn nicht, passiert nichts.
  3. FIRST bedeutet find the first available, ignore rest
+0

Das ist wirklich eine großartige Antwort. –

+0

Schönes Bild - viel besser als die Wand der Textdokumente, die normalerweise auf diesem Zeug gesehen wird. –

Verwandte Themen