Nach anlegen einer .bash_profile Farbschema weg

bolshi

bolshi

Aktives Mitglied
Thread Starter
Dabei seit
13.03.2009
Beiträge
775
Reaktionspunkte
19
Hallo,
bislang gab's nur eine .bash_rc. Beim Einrichten einer Software lautete einer der Installationspunkte:

PATH-Variable in der .bash_profile anlegen

Im Anschluss war das Farbschema weg. Nachdem ich den PATH-Eintrag in der .bashrc anlegte und die .bash_profile löschte, war das Farbschema wieder vorhanden.

Wie kann ich die .bash_profile und das Farbschema behalten?
 
Übernehme das Farbschema in der bash_profile. Die bash_rc wird in macOs für gewöhnlich nicht verwendet. Da das System grundsätzlich die Shell als Login-Shell verwendet greift es nur auf die bash_profile zu. Es gibt also gegenüber Unices keinen Unterschied zwischen Login und non-Login - Shells das liegt daran, dass beim macOS beim Login keine Scripte (wie bei Unices) ausgeführt werden sondern über die launchd.

Wenn du sicher sein willst das nur die bash_profile verwendet werden soll dann trage folgendes in der bash_rc ein:
Code:
source ~/.bash_profile
 
wenn, dann umgekehrt:
Code:
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
in die .bash_profile eintragen.
 
Die bash_rc wird in macOs für gewöhnlich nicht verwendet.
Sie wird sehr wohl von der Shell sourced. Wenn du mit deinem Satz eine "best practice" Empfehlung aussprechen wolltest hab ich dich falsch verstanden, aber es wird sehr wohl auf die bashrc zugegriffen.
Ich habe meine ganze bash-spezifische Konfig in der bashrc und die zsh-spezifische in der zshrc (es gibt im übrigen leichte Unterschiede in der Reihenfolge in der zsh und bash die Dateien sourcen) und diese sourcen dann wiederum eine Art "globale" Konfiguration. Die bashrc (wie auch zshrc) wird dabei sowie bei einer Session im Terminal wie auch bei Einwahl via SSH (hier gelten andere Source-Reihenfolgen) berücksichtigt.
 
When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and
executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile,
~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.
The --noprofile option may be used when the shell is started to inhibit this behavior.

When a login shell exits, bash reads and executes commands from the file ~/.bash_logout, if it exists.

When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file
exists. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands
from file instead of ~/.bashrc. -- from man bash

Verwendest du eine Login-Shell (also die Standardeinstellung in macOS) dann werden die profile in der Reihenfolge wie oben angegeben ausgelesen. Verwendest du dagegen eine andere Shell oder hast du diese als NICHT Anmelde-Shell konfiguriert dann wird die bashrc ausgelesen. Du kannst ja mal testweise den Inhalt deiner bashrc kopieren und in die .bash_profile einfügen, dann die bashrc aus deinem Home-Verzeichnis verschieben. Aus- und wieder Einloggen und testen ob die Einstellungen die du vorgenommen hast geladen werden.

Ich nehme an du hast einen Eintrag im .bash_profile das du sourced richtig?
 
Benutze die Shell so wie sie vom Terminal per default instanziiert wird, das müsste login sein. Eine .bash_profile hab ich nicht.
 
was willst du damit ausdrücken? :p
 
Zurück
Oben Unten