Você sabe que existem muitos shells no mundo UNIX, mas a maioria deles é:
Bourne shell == /bin/sh => inventor : Stephen Bourne
BASH (Bourne Again Shell) == /bin/bash => inventor : (Brian Fox , under GNU project) (powerful shell)
C SHELL == /bin/csh ==> inventor: Bill Joy, Inventor of TCP/IP Stack
Korn Shell == /bin/ksh ==> inventor: David Korn under Bell Labs
Z Shell == /bin/zsh ==> (Powerful shell)
TENEX C SHELL == /bin/tcsh => derived from c shell
Debian Almquist shell == /bin/dash => derived from Almquist shell (ash under NetBSD project) (Dash born from lenny)
Mas a sua pergunta é sobre ~/.bash_profile e ~/.profile :
Quando você faz o login em uma máquina UNIX, ele redireciona para seu diretório pessoal, de acordo com o shell escolhido por um administrador no último campo de /etc/passwd como:
mohsen:x:1000:1000:Mohsen Pahlevanzadeh,,,:/home/mohsen:/bin/bash
Seu shell é executado e, por padrão, cada shell tem um arquivo definido para login e logout . Quando você faz login em bash shell , ~/.profile é executado e quando você executa logout , ~/.bash_logout é executado.
~/.bash_history file mantém seu comando de entrada.
Arquivo de inicialização em cada shell
TENEX C SHELL:
~/.login = > When you login
~/.logout = > When you logout
~/.tcshrc = > same as ~./bashrc in bash shell
You can set variable $histfile as name of history file and variable $history as number of commands to keeping.
Z SHELL
Na verdade, é um poderoso shell e, se eu tiver tempo livre, migre para ele.
Exceto de outro shell, o shell Z possui muitos arquivos de configuração e arquivos de inicialização, apenas eu escrevo:
$ZDOTDIR/.zshenv
$ZDOTDIR/.zprofile
$ZDOTDIR/.zshrc
$ZDOTDIR/.zlogin
$ZDOTDIR/.zlogout
/tmp/zsh*
/etc/zshenv
/etc/zprofile
/etc/zshrc
/etc/zlogin
Note: if $ZDOTDIR unset, home set.
C SHELL
Nota: Shell TENEX C bifurcado de C Shell, C Shell suporta por BSD.
Se você está familiarizado com a programação em linguagem C, então você acredita em sua sintaxe como essa.
~/.login
~/.cshrc
~/.logout
Note : if you need to it, use tcsh and csh is old but live.
Korn Shell
~/.profile
rc file == user defined
logout file == N/A
Bourne Again SHELL (BASH)
É um shell muito poderoso, nascido sob o projeto GNU e bifurcado pela Bourne Shell.
~/.bash_login
~/.bash_logout
~/.bashrc
~/.bash_profile
~/.bash_history
When you login, bash runs ~/.bash_profile and ~/.bash_profile runs ~/.bashrc, indeed ~/.bashrc isn't bash initialization file.Because bash doesn't run it.
Bourne Shell
É inoperante, mesmo quando você usa man sh , você vê o manual de dash .
Sua resposta:
~/.bash_profile trabalham com bash shell , mas ~/.profile trabalham com bourne e korn shell