2011-10-14 1 views
2

봐 :왜 '스크립트'유틸리티가 Cygwin에서 SHELL을 필요로합니까 (Linux에서는 잘 작동합니까)? 내 세션에

 
    gavenko+bash# echo $SHELL 
    /bin/bash 
    gavenko+bash# script 
    Script started, file - typescript 
            sh-4.1$ ^C 
    sh-4.1$ exit 
    Script started, file - typescript 


    gavenko+bash# SHELL=/bin/bash script 
    Script started, file - typescript 
            gavenko+bash# ^C 
    gavenko+bash# exit 
    Script started, file - typescript 


    gavenko+bash# export SHELL 
    gavenko+bash# script 
    Script started, file - typescript 
            gavenko+bash# ^C 
    gavenko+bash# exit 

당신이 처음 스크립트 셸을 사용하지 않고, 두 번째는 사용 확인하실 수 있으며, 세 번째는 그것을 사용한다. 그래서 SHELL의 ENV var에가 bash에 의해 수출하지 않는

...

이유는 무엇입니까?

이 바로이 '~/.bashrc에'에

 
    export SHELL 

를 추가 할 수 있습니까? 내 질문에

+2

힌트 : 우리의 대부분은 러시아어를 구사하지 않기 때문에, SO : – sehe

+0

@sehe 죄송 위해 캡처 스크린 샷을하기 전에'수출 LANG = C' 다음을 고려하십시오. 나는이 부분이 그렇게 중요하지 않다고 생각했다. 당신은 greate 일을 !! – gavenkoa

+0

superuser.com에 더 적합한 것 같습니다. –

답변

2

참조 답변 : http://cygwin.com/ml/cygwin/2011-10/msg00269.html

 
This is a bug in bash which hides broken behavior 
in the OS. 

Bash expects this to be an existing environment variable, 
and it usually is in normal Unix like operating systems. 

However, bash internally sets the variable if it is 
missing (without exporting it): 

`SHELL' 
The full pathname to the shell is kept in this environment 
variable. If it is not set when the shell starts, Bash assigns to 
it the full pathname of the current user's login shell. 

It is correct not to export the variable. Bash might not be 
the user's shell, so it has no right to introduce itself as 
the SHELL to child processes. 
관련 문제