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
ENVis set on entry to an interactive shell, or is set in the.profileof 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.profilefile, and commands that are executed for every interactive shell inside theENVfile. To set theENVvariable to some file, place the following line in your.profileof your home directoryENV=$HOME/.shinit; export ENVsubstituting for
.shinitany 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