24 Şubat 2021 Çarşamba

~/.bashrc Dosyası - Her Yeni Kabuk İçin Çalışır

Giriş
Açıklaması şöyle. Her etkileşimli kabuk (interactive shell) açıldığında bu dosya okunur
~/.bashrc is appropriate for aliases. ~/.bash_profile is run only for login shells, ~/.bashrc is run for every interactive shell. And, yes, you need to re-source ~/.bashrc after editing it to take immediate effect.
Açıklaması şöyle. ssh ile bağlanınca bu dosya normalde çalışır.
(man bash) Bash attempts to determine when it is being run with its standard input connected to a network connection, as when executed by the remote shell daemon, usually rshd, or the secure shell daemon sshd. If bash determines it is being run in this fashion, it reads and executes commands from ~/.bashrc, if that file exists and is readable. It will not do this if invoked as sh. The --norc option may be used to inhibit this behavior, and the --rcfile option may be used to force another file to be read, but neither rshd nor sshd generally invoke the shell with those options or allow them to be specified.
Dosyanın içinde şöyle bir satır var. Yani ".bash_aliases" dosyasını da okur
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi
Bu Dosyanın Değişmesini Engelleme
Bazı kurulumlardan sonra bu dosyaya bir şeyler eklenebiliyor. Bunu engellemek için şöyle yaparız
If you end your .bashrc with
return 0
Bash will ignore any lines added after that, since .bashrc is handled like a sourced script:

Hiç yorum yok:

Yorum Gönder