이는 경로가 불완전하여 "명령을 찾을 수 없는 문제"가 아닙니다. 외부 명령나타나다확인을 시작하고 지금 찾으세요터미널 출력을 생성하는 대신 터미널 입력.
.profile/.bashrc 파일 등을 플러시한 것 같은데... 문제의 원인을 볼 수 없습니다.
저는 mintty 2.5.1(i686-pc-cygwin)을 사용하여 cygwin bash를 대화식으로 시작합니다. 일부 스크립트를 실행하면 $ 프롬프트가 표시됩니다. shopt -x가 설정되어 명령이 에코되는 것을 볼 수 있습니다.
(MinGW도 설치되어 있으며 cygwin 이후 DOS 경로에 있습니다.)
내가 입력하는 모든 외부 명령은 터미널에서 행을 읽어 응답됩니다. $ 프롬프트를 다시 표시할 수 있는 유일한 방법은 Ctrl-C를 누르고 Enter를 누르는 것입니다.
이것은 cygwin이 시작한 스크립트에서 시작하는 터미널 출력입니다. 어쩌면 앞 어딘가에 내 실수가 있을 수도 있습니다. 마지막으로 "mount" 및 "man mount" 명령을 실행해 보았습니다. 이 명령은 앞에 "+"(shopt -x에서)가 붙은 명령을 에코한 다음 입력을 읽습니다.
+ '[' -z '' ']'
+ : /usr/bin:/c:/c/tools:/c/WINDOWS/System32:/c/WINDOWS:/c/WINDOWS/System32/WBEM:/c/WINDOWS/system32/WindowsPowerShell/v1.0:/c/cgywin/bin:/c/MinGW/bin:/c/Documents and Settings/All Users/Application Data/Oracle/Java/javapath:/c/Program Files/rexx.org/Regina:/c/Program Files/rexx.org/THE
+ '[' addwinpath = addwinpath ']'
+ PATH='/usr/local/bin:/usr/bin:/usr/bin:/c:/c/tools:/c/WINDOWS/System32:/c/WINDOWS:/c/WINDOWS/System32/WBEM:/c/WINDOWS/system32/WindowsPowerShell/v1.0:/c/cgywin/bin:/c/MinGW/bin:/c/Documents and Settings/All Users/Application Data/Oracle/Java/javapath:/c/Program Files/rexx.org/Regina:/c/Program Files/rexx.org/THE'
+ INFOPATH=/usr/local/info:/usr/share/info:/usr/info
++ /usr/bin/id -un
+ USER=User
+ unset TMP TEMP
+ TMP=/tmp
+ TEMP=/tmp
+ p='/proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows NT/CurrentVersion/Windows/Device'
+ '[' -e '/proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows NT/CurrentVersion/Windows/Device' ']'
+ read -r PRINTER
+ PRINTER='HP LaserJet Professional P1606dn'
+ unset p
+ umask 022
+ '[' '!' -d '/c/Documents and Settings/User' ']'
+ readonly PROFILEREAD=true
+ PROFILEREAD=true
+ '[' '!' -z '' ']'
+ cd '/c/Documents and Settings/User'
++ /usr/bin/hostname
+ HOSTNAME=hej
+ profile_d sh
+ _LC_ALL_SET_=
+ _LC_SAVE_=null
+ LC_ALL=C
+ '[' null = null ']'
+ for file in '/etc/profile.d/*.$1'
+ '[' -e /etc/profile.d/lang.sh ']'
+ . /etc/profile.d/lang.sh
++ test -z ''
+++ /usr/bin/locale -uU
++ export LANG=en_US.UTF-8
++ LANG=en_US.UTF-8
+ for file in '/etc/profile.d/*.$1'
+ '[' -e /etc/profile.d/tzset.sh ']'
+ . /etc/profile.d/tzset.sh
++ test -z ''
+++ /usr/bin/tzset
++ export TZ=America/New_York
++ TZ=America/New_York
+ unset LC_ALL
+ unset file
+ unset _LC_ALL_SET_
+ unset _LC_SAVE_
+ '[' '!' 'x4.3.46(6)-release' = x ']'
+ '[' -f /etc/bash.bashrc ']'
+ . /etc/bash.bashrc
++ [[ -z '' ]]
++ CYG_SYS_BASHRC=1
++ [[ himxBH != *i* ]]
++ export 'EXECIGNORE=*.dll'
++ EXECIGNORE='*.dll'
++ PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
+ export PROFILEREAD PATH ORIGINAL_PATH INFOPATH USER TMP TEMP PRINTER HOSTNAME PS1 SHELL
+ echo '.profile in C:\Documents and Settings\User\.profile'
.profile in C:\Documents and Settings\User\.profile
+ set -x
++ uname -o
+ [[ Cygwin == \C\y\g\w\i\n ]]
+ export CYGDRIVE=/cygdrive
+ CYGDRIVE=/cygdrive
+ export 'PATH=./://cygdrive/c/bin:/usr/local/bin:/usr/bin:/usr/bin:/c:/c/tools:/c/WINDOWS/System32:/c/WINDOWS:/c/WINDOWS/System32/WBEM:/c/WINDOWS/system32/WindowsPowerShell/v1.0:/c/cgywin/bin:/c/MinGW/bin:/c/Documents and Settings/All Users/Application Data/Oracle/Java/javapath:/c/Program Files/rexx.org/Regina:/c/Program Files/rexx.org/THE:/c/Documents and Settings/User'
+ PATH='./://cygdrive/c/bin:/usr/local/bin:/usr/bin:/usr/bin:/c:/c/tools:/c/WINDOWS/System32:/c/WINDOWS:/c/WINDOWS/System32/WBEM:/c/WINDOWS/system32/WindowsPowerShell/v1.0:/c/cgywin/bin:/c/MinGW/bin:/c/Documents and Settings/All Users/Application Data/Oracle/Java/javapath:/c/Program Files/rexx.org/Regina:/c/Program Files/rexx.org/THE:/c/Documents and Settings/User'
+ export HOME=/cygdrive/g/GNU-GCC/home/User
+ HOME=/cygdrive/g/GNU-GCC/home/User
+ cd /cygdrive/g/GNU-GCC/home/User
+ '[' -f /cygdrive/g/GNU-GCC/home/User/.bashrc ']'
+ . /cygdrive/g/GNU-GCC/home/User/.bashrc
++ set -o notify
++ set -o noclobber
++ set -o ignoreeof
++ set -o nounset
++ set -o xtrace
++ alias 'debug=set -o nounset; set -o xtrace'
++ ulimit -S -c 0
++ shopt -s checkhash
++ shopt -s checkwinsize
++ shopt -s sourcepath
++ shopt -s no_empty_cmd_completion
++ shopt -s cmdhist
++ shopt -s histappend histreedit histverify
++ shopt -s extglob
++ shopt -s nocaseglob
++ shopt -s expand_aliases
++ shopt -u cdspell
++ shopt -u cdable_vars
++ shopt -u mailwarn
++ unset MAILCHECK
++ alias cls=clsb
++ set +u
++ [[ -z '' ]]
++ unalias cls
++ alias 'cls=tput reset'
++ set -u
++ alias 'rm=rm -i'
++ alias 'cp=cp -i'
++ alias 'mv=mv -i'
++ alias h=history
++ alias 'j=jobs -l'
++ alias 'which=type -a'
++ alias '..=cd ..'
++ alias 'path=echo -e ${PATH//:/\\n}'
++ alias 'libpath=echo -e ${LD_LIBRARY_PATH//:/\\n}'
++ alias 'du=du -kh'
++ alias 'df=df -kTh'
++ alias 'pushnullglob=local nullglob=$(shopt -p nullglob) ; shopt -s nullglob'
++ alias 'popnullglob=$nullglob ; unset nullglob'
++ alias 'ls=ls -h --color'
++ alias 'lx=ls -lXB'
++ alias 'lk=ls -lSr'
++ alias 'lt=ls -ltr'
++ alias 'lc=ls -ltcr'
++ alias 'lu=ls -ltur'
++ alias 'll=ls -lv --group-directories-first'
++ alias 'lm=ll |more'
++ alias 'lr=ll -R'
++ alias 'la=ll -A'
++ alias 'tree=tree -Csuh'
++ alias more=less
++ export PAGER=less
++ PAGER=less
++ export LESSCHARSET=latin1
++ LESSCHARSET=latin1
++ export 'LESSOPEN=|/usr/bin/lesspipe.sh %s 2>&-'
++ LESSOPEN='|/usr/bin/lesspipe.sh %s 2>&-'
++ export 'LESS=-i -w -s -z-4 -g -M -X -r -f -P%t?f%f \
:stdin .?pb%pb\%:?lbLine %lb:?bbByte %bb:-...'
++ LESS='-i -w -s -z-4 -g -M -X -r -f -P%t?f%f \
:stdin .?pb%pb\%:?lbLine %lb:?bbByte %bb:-...'
++ export 'LESS_TERMCAP_mb='
++ LESS_TERMCAP_mb=''
++ export 'LESS_TERMCAP_md='
++ LESS_TERMCAP_md=''
++ export 'LESS_TERMCAP_me='
++ LESS_TERMCAP_me=''
++ export 'LESS_TERMCAP_se='
++ LESS_TERMCAP_se=''
++ export 'LESS_TERMCAP_so='
++ LESS_TERMCAP_so=''
++ export 'LESS_TERMCAP_ue='
++ LESS_TERMCAP_ue=''
++ export 'LESS_TERMCAP_us='
++ LESS_TERMCAP_us=''
++ export -f wcd
++ [[ C:\Documents and Settings\User == \C\:\\\U\s\e\r\s\\\j\a\r\e\d ]]
++ export GNUGCC=/cygdrive/g/GNU-GCC
++ GNUGCC=/cygdrive/g/GNU-GCC
++ alias 'stamp=export STAMP=`date +D%Y%m%d.T%H%M%S`; export LOGS=`pwd`/logs/${STAMP}; mkdir -pv ${LOGS}'
++ alias 'gcd=cd /cygdrive/g/GNU-GCC/toolchain-avr'
++ alias 'gcc=cd /cygdrive/g/GNU-GCC/toolchain-avr/gcc-build; stamp; ../gcc/libgcc/configure'
++ alias 'avr=gcd; stamp; (build_package-avr-gcc.bash "$STAMP" "$LOGS" 2>&1) | tee $LOGS/_package.log'
++ alias 'avo=gcd; stamp; (package-avr-gcc.bash 2>&1) | tee $LOGS/_package.log'
++ alias -p
alias ..='cd ..'
alias avo='gcd; stamp; (package-avr-gcc.bash 2>&1) | tee $LOGS/_package.log'
alias avr='gcd; stamp; (build_package-avr-gcc.bash "$STAMP" "$LOGS" 2>&1) | tee $LOGS/_package.log'
alias cls='tput reset'
alias cp='cp -i'
alias debug='set -o nounset; set -o xtrace'
alias df='df -kTh'
alias du='du -kh'
alias gcc='cd /cygdrive/g/GNU-GCC/toolchain-avr/gcc-build; stamp; ../gcc/libgcc/configure'
alias gcd='cd /cygdrive/g/GNU-GCC/toolchain-avr'
alias h='history'
alias j='jobs -l'
alias la='ll -A'
alias lc='ls -ltcr'
alias libpath='echo -e ${LD_LIBRARY_PATH//:/\\n}'
alias lk='ls -lSr'
alias ll='ls -lv --group-directories-first'
alias lm='ll |more'
alias lr='ll -R'
alias ls='ls -h --color'
alias lt='ls -ltr'
alias lu='ls -ltur'
alias lx='ls -lXB'
alias more='less'
alias mv='mv -i'
alias path='echo -e ${PATH//:/\\n}'
alias popnullglob='$nullglob ; unset nullglob'
alias pushnullglob='local nullglob=$(shopt -p nullglob) ; shopt -s nullglob'
alias rm='rm -i'
alias stamp='export STAMP=`date +D%Y%m%d.T%H%M%S`; export LOGS=`pwd`/logs/${STAMP}; mkdir -pv ${LOGS}'
alias tree='tree -Csuh'
alias which='type -a'
User@hej ~
$ shopt
+ shopt
autocd off
cdable_vars off
cdspell off
checkhash on
checkjobs off
checkwinsize on
cmdhist on
compat31 off
compat32 off
compat40 off
compat41 off
compat42 off
complete_fullquote on
direxpand off
dirspell off
dotglob off
execfail off
expand_aliases on
extdebug off
extglob on
extquote on
failglob off
force_fignore on
globstar off
globasciiranges off
gnu_errfmt off
histappend on
histreedit on
histverify on
hostcomplete on
huponexit off
interactive_comments on
lastpipe off
lithist off
login_shell on
mailwarn off
no_empty_cmd_completion on
nocaseglob on
nocasematch off
nullglob off
progcomp on
promptvars on
restricted_shell off
shift_verbose off
sourcepath on
xpg_echo off
User@hej ~
$ set
+ set
ALLUSERSPROFILE='C:\Documents and Settings\All Users'
APPDATA='C:\Documents and Settings\User\Application Data'
BASH=/bin/bash
BASHOPTS=checkhash:checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:histappend:histreedit:histverify:hostcomplete:interactive_comments:login_shell:no_empty_cmd_completion:nocaseglob:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="4" [1]="3" [2]="46" [3]="6" [4]="release" [5]="i686-pc-cygwin")
BASH_VERSION='4.3.46(6)-release'
CLIENTNAME=Console
COLUMNS=132
COMMONPROGRAMFILES='C:\Program Files\Common Files'
COMPUTERNAME=HEJ
COMSPEC='C:\WINDOWS\System32\CMD.EXE'
CYGDRIVE=/cygdrive
CYGWIN_HOME='C:\cygwin'
CYG_SYS_BASHRC=1
CommonAppData='C:\Documents and Settings\All Users\Application Data'
CommonDesktop='C:\Documents and Settings\All Users\Desktop'
CommonDocuments='C:\Documents and Settings\All Users\Documents'
CommonFavorites='C:\Documents and Settings\All Users\Favorites'
CommonMusic='C:\Documents and Settings\All Users\Documents\My Music'
CommonPictures='C:\Documents and Settings\All Users\Documents\My Pictures'
CommonTemplates='C:\Documents and Settings\All Users\Templates'
CommonVideos='C:\Documents and Settings\All Users\Documents\My Videos'
DIRSTACK=()
DefaultUserProfile='C:\Documents and Settings\Default User'
DevMgr_Show_Details='*'
DevMgr_Show_NonPresent_Devices='*'
EUID=197614
EXECIGNORE='*.dll'
FP_NO_HOST_CHECK=NO
GNUGCC=/cygdrive/g/GNU-GCC
GROUPS=()
HISTFILE='/c/Documents and Settings/User/.bash_history'
HISTFILESIZE=500
HISTSIZE=500
HOME=/cygdrive/g/GNU-GCC/home/User
HOMEDRIVE=C:
HOMEPATH='\Documents and Settings\User'
HOSTNAME=hej
HOSTTYPE=i686
IFS=$' \t\n'
IGNOREEOF=10
INFOPATH=/usr/local/info:/usr/share/info:/usr/info
JD2_HOME='C:\Documents and Settings\User\Local Settings\Application Data\JDownloader 2.0'
LANG=en_US.UTF-8
LESS=$'-i -w -s -z-4 -g -M -X -r -f -P%t?f%f \\\n:stdin .?pb%pb\\%:?lbLine %lb:?bbByte %bb:-...'
LESSCHARSET=latin1
LESSOPEN='|/usr/bin/lesspipe.sh %s 2>&-'
LESS_TERMCAP_mb=$'\E[01;31m'
LESS_TERMCAP_md=$'\E[01;31m'
LESS_TERMCAP_me=$'\E[0m'
LESS_TERMCAP_se=$'\E[0m'
LESS_TERMCAP_so=$'\E[01;44;33m'
LESS_TERMCAP_ue=$'\E[0m'
LESS_TERMCAP_us=$'\E[01;32m'
LINES=80
LOGONSERVER='\\HEJ'
MACHTYPE=i686-pc-cygwin
MTPPKROOT='C:\WMSDK\MTPPK12\Responder'
NUMBER_OF_PROCESSORS=2
OLDPWD='/c/Documents and Settings/User'
OPTERR=1
OPTIND=1
ORIGINAL_PATH='/usr/bin:/c:/c/tools:/c/WINDOWS/System32:/c/WINDOWS:/c/WINDOWS/System32/WBEM:/c/WINDOWS/system32/WindowsPowerShell/v1.0:/c/cgywin/bin:/c/MinGW/bin:/c/Documents and Settings/All Users/Application Data/Oracle/Java/javapath:/c/Program Files/rexx.org/Regina:/c/Program Files/rexx.org/THE'
OS=Windows_NT
OSTYPE=cygwin
PAGER=less
PATH='./://cygdrive/c/bin:/usr/local/bin:/usr/bin:/usr/bin:/c:/c/tools:/c/WINDOWS/System32:/c/WINDOWS:/c/WINDOWS/System32/WBEM:/c/WINDOWS/system32/WindowsPowerShell/v1.0:/c/cgywin/bin:/c/MinGW/bin:/c/Documents and Settings/All Users/Application Data/Oracle/Java/javapath:/c/Program Files/rexx.org/Regina:/c/Program Files/rexx.org/THE:/c/Documents and Settings/User'
PATHEXT='.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.REX;.Rexx;.PSC1'
PIPESTATUS=([0]="0")
PPID=944
PRINTER='HP LaserJet Professional P1606dn'
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER='x86 Family 15 Model 6 Stepping 2, GenuineIntel'
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0602
PROFILEREAD=true
PROGRAMFILES='C:\Program Files'
PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
PS2='> '
PS4='+ '
PSModulePath='C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\'
PWD=/cygdrive/g/GNU-GCC/home/User
REGINA_HOME='C:\Program Files\rexx.org\Regina'
REGINA_LANG=en
REGINA_LANG_DIR='C:\Program Files\rexx.org\Regina'
SESSIONNAME=Console
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:ignoreeof:interactive-comments:monitor:noclobber:notify:nounset:xtrace
SHLVL=1
SYSTEMDRIVE=C:
SYSTEMROOT='C:\WINDOWS'
TEMP=/tmp
TERM=xterm
THE_HELP_FILE='C:\Program Files\rexx.org\THE\THE_Help.txt'
THE_HOME_DIR='C:\Program Files\rexx.org\THE'
THE_MACRO_PATH='C:\Program Files\rexx.org\THE\extras'
TMP=/tmp
TZ=America/New_York
UID=197614
USER=User
USERDOMAIN=HEJ
USERNAME=User
USERPROFILE='C:\Documents and Settings\User'
WINDIR='C:\WINDOWS'
_=shopt
_NT_SYMBOL_PATH='srv*c:\symbols*https://msdl.microsoft.com/download/symbols'
profile_d ()
{
_LC_ALL_SET_="${LC_ALL+set}";
_LC_SAVE_="${LC_ALL-null}";
LC_ALL=C;
if [ "${_LC_SAVE_}" = "null" ]; then
for file in /etc/profile.d/*.$1;
do
[ -e "${file}" ] && . "${file}";
done;
unset LC_ALL;
else
for file in /etc/profile.d/*.$1;
do
[ -e "${file}" ] && LC_ALL="${_LC_SAVE_}" . "${file}";
done;
LC_ALL="${_LC_SAVE_}";
fi;
unset file;
unset _LC_ALL_SET_;
unset _LC_SAVE_
}
wcd ()
{
cd $(sed -e 's~\\~/~g' -e 's~c:~$CYGDRIVE/c~g' -e 's~g:~$CYGDRIVE/g~' <<< "$@")
}
User@hej ~
$ mount
+ mount
Ctrl-c entered <------
User@hej ~
$
User@hej ~
$
User@hej ~
$ man mount
+ man mount
Ctrl-c entered <------
User@hej ~
$
DOS 경로:
PATH=C:\cygwin\bin\;C:\;c:\tools;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\System32\WBEM;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\cgywin\bin;C:\MinGW\bin;C:\Documents and Settings\All Users\Application Data\Oracle\Java\javapath;C:\Program Files\rexx.org\Regina;C:\Program Files\rexx.org\THE
답변1
다음과 같이 로컬 볼륨에 대한 FSTAB에 항목을 추가하여 시스템을 "손상"시켰습니다.
# /etc/fstab
#
# This file is read once by the first process in a Cygwin process tree.
# To pick up changes, restart all Cygwin processes. For a description
# see https://cygwin.com/cygwin-ug-net/using.html#mount-table
# This is default anyway:
none /cygdrive cygdrive binary,posix=0,user 0 0
c:/ /c ntfs text,posix=0 0 0
d:/ /d ntfs text,posix=0 0 0
f:/ /f ntfs text,posix=0 0 0
g:/ /g ntfs text,posix=0 0 0
fstab을 다음과 같이 변경하여 "고정"했습니다.
none /cygdrive cygdrive binary,posix=0,user 0 0
none /tmp usertemp binary,posix=0 0 0
c:/ /c ntfs binary,posix=0,cygexec 0 0
d:/ /d ntfs binary,posix=0,cygexec 0 0
f:/ /f ntfs binary,posix=0,cygexec 0 0
g:/ /g ntfs binary,posix=0,cygexec 0 0
내가 생각하기에 4개 드라이브(c,d,f,g)를 "exec"로 마운트하지 않으면 cygwin이 외부에서 검색할 때마다 "마법의" 바이트를 찾기 위해 여러 파일을 열고 읽는다는 것입니다. 파일이 실행 가능한 경우.
한편 mintty는 내가 ctrl-c를 눌러 종료할 때까지 내 입력을 TypeAhead로 버퍼링하여 내 명령에 대해 계속 실행 중인 검색을 종료합니다.
옵션에 "cygexec"를 추가하면 검색은 이제 디렉터리의 실행 가능 플래그만 참조하고 최대 속도로 실행됩니다.