Executando qualquer tipo de script de login quando sh está vinculado ao bash

2

Meu problema: meu host oferece ssh ao servidor compartilhado. Eu quero configurar um par de aliases e tal, então eu estou tentando obter um script de login de qualquer sabor para ser executado. Se meu shell fosse simplesmente bash, eu simplesmente adicionaria minhas coisas a um dos arquivos de pontos e terminaria com isso.

Agora, quando isso acontece, meu shell é especificado como /bin/sh , que está vinculado ao bash:

sh-3.2$ /bin/sh --version
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
sh-3.2$ /bin/bash --version
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
sh-3.2$

Eu tentei criar todos os suspeitos usuais, ~/.bash_profile , ~/.bash_login , ~/.bashrc , ~/.profile e .login sem sorte.

O que posso fazer para executar um comando na inicialização? Qualquer nome de arquivo que eu tenha esquecido de tentar? Devem qualquer um destes trabalhar sob as minhas condições? Ou seja meu host fez algo para desativar o script de login?

Eu prefiro não pedir ao meu host para definir uma shell diferente para mim até que eu tenha acertado meus fatos sobre isso.

    
por nitro2k01 26.11.2011 / 06:43

2 respostas

3

No manual do Bash seção 6.2 Arquivos de Inicialização da Bash :

Invoked with name sh

If Bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the posix standard as well.

When invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first attempts to read and execute commands from /etc/profile and ~/.profile, in that order. The --noprofile option may be used to inhibit this behavior. When invoked as an interactive shell with the name sh, Bash looks for the variable ENV, expands its value if it is defined, and uses the expanded value as the name of a file to read and execute. Since a shell invoked as sh does not attempt to read and execute commands from any other startup files, the --rcfile option has no effect. A non-interactive shell invoked with the name sh does not attempt to read any other startup files.

    
por 26.11.2011 / 08:36
0

Você pode executar o chsh para mudar seu shell para / bin / bash.

chsh -s /bin/bash

bash invocado como / bin / sh deve executar seu ~ / .profile no logon.

    
por 26.11.2011 / 08:29