O dash
shell (e sh
se implementado por dash
) lê /etc/profile
quando iniciado como um shell de login. Em seguida, lê ~/.profile
. O arquivo ~/.profile
pode definir e exportar a variável de ambiente ENV
. Essa variável deve conter o caminho para um arquivo originado por shells que não são de login. Isso geralmente é feito por usuário, e não em qualquer arquivo em /etc
.
Do manual dash
(minha ênfase):
If the environment variable
ENV
is set on entry to an interactive shell, or is set in the.profile
of a login shell, the shell next reads commands from the file named inENV
. Therefore, a user should place commands that are to be executed only at login time in the.profile
file, and commands that are executed for every interactive shell inside theENV
file. To set theENV
variable to some file, place the following line in your.profile
of your home directoryENV=$HOME/.shinit; export ENV
substituting for
.shinit
any filename you wish.
Ao chamar sh
ou dash
para criar uma sessão shell de logon não interativo de algum outro shell ou processo, apenas certifique-se de que ENV
esteja definido para o arquivo de inicialização de shell apropriado. Isso pode ser feito a partir de qualquer shell do tipo Bourne usando
ENV="$HOME/.shinit" sh
ou
ENV="$HOME/.shinit" dash