gVim não origina .bashrc, .bash_profile ou .profile a partir de um shell de não login não interativo

1

Eu tenho o seguinte no meu .vimrc

set shell=C:/cygwin/bin/bash
set shellcmdflag=-c
set shellxquote=\"

Portanto, o shell que estou usando é não interativo e não faz login. Eu pensei que não-login shells fonte .bashrc, mas isso não parece ser o caso. Eu não quero fazer meu shell interactive ou login . Existe uma maneira para mim fonte .bashrc de outra maneira? Meu .bash_profile já origina .bashrc

    
por Forethinker 21.04.2013 / 02:04

1 resposta

4

O que você descreve é um comportamento normal. Ao iniciar o bash com a opção -c , será lançado um shell não interativo, sem login . Isso significa que o bash não irá fornecer nenhum de seus arquivos de configuração clássicos, mas a variável $BASH_ENV . Como explicado na página do bash man:

  • não-interativo, não-login shell:

    When bash is started non-interactively, to run a shell script, for example, it looks for the variable BASH_ENV in the environment, expands its value if it appears there, and uses the expanded value as the name of a file to read and execute. Bash behaves as if the following command were executed:

    if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
    
  • interativo, shell de login:

    When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

  • shell interativo de não login

    When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of /etc/bash.bashrc and ~/.bashrc.

Portanto, se você deseja que o seu shell não interativo e não de logon forneça ~/.bahsrc , será necessário definir o valor de BASH_ENV to ~/.bashrc . Adicione esta linha aos seus arquivos ~/.bashrc ou ~/.profile :

export BASH_ENV=~/.bashrc
    
por 21.04.2013 / 15:53