在msysGit中,当我运行type -a tee(.exe)
时,它会显示3行同一个文件:
$ type -a tee.exe
tee.exe is /bin/tee.exe
tee.exe is /bin/tee.exe
tee.exe is /bin/tee.exe
tee.exe is /c/Program Files (x86)/Git/bin/tee.exe
tee.exe is /c/Program Files (x86)/Drush/GnuWin32/bin/tee.exe
然而,当我在同一台机器上运行的Fedora 20 VM中输入相同的行时,情况并非如此:
[sean@localhost ~]$ type -a tee
tee is /bin/tee
tee is /usr/bin/tee
为什么会这样?
答案 0 :(得分:0)
我发现我的PATH有几次重复的文件夹。感谢@rojomoke指出了可能性。
我的msysGit路径
$ echo $PATH
/c/Users/Sean/bin:.:/usr/local/bin:/mingw/bin:/bin:/c/Users/Sean/bin:.:/usr/local/bin:/min
n:/c/Users/Sean/bin:.:/usr/local/bin:/mingw/bin:/bin:/c/Program Files (x86)/Git/cmd:/c/Pro
(x86)/Git/bin:/c/MinGW/bin:/c/MinGW/msys/1.0/bin:/c/Python33/:/c/Program Files (x86)/Inte
ent/:/c/Program Files/Intel/iCLS Client/:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System3
WINDOWS/System32/WindowsPowerShell/v1.0/:/c/Program Files/Intel/Intel(R) Management Engine
s/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files (x
Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management
mponents/IPT:/c/Program Files/Intel/WiFi/bin/:/c/Program Files/Common Files/Intel/Wireless
/strawberry/c/bin:/c/strawberry/perl/site/bin:/c/strawberry/perl/bin:/c/Program Files/Micr
Platform Installer/:/c/Program Files (x86)/Microsoft ASP.NET/ASP.NET Web Pages/v1.0/:/c/Pr
s (x86)/Windows Kits/8.0/Windows Performance Toolkit/:/c/Program Files/Microsoft SQL Serve
s/Binn/:/c/Program Files (x86)/Microsoft SQL Server/90/Tools/binn/:/c/Program Files/nodejs
am Files (x86)/OpenAFS/Common:/c/Program Files (x86)/QuickTime/QTSystem/:/c/HashiCorp/Vagr
/Ruby200-x64/bin:/c/Users/Sean/AppData/Local/Box/Box Edit/:/c/Program Files (x86)/SSH Comm
Security/SSH Secure Shell:/c/ProgramData/Drush/:/c/Program Files (x86)/Drush/GnuWin32/bin
m Files (x86)/Drush/Php:/c/Users/Sean/AppData/Roaming/npm:/c/Users/Sean/Documents/Lisp:/c/
les/GCL-2.6.1/lib/gcl-2.6.1/unixport:/c/wamp/bin/mysql/mysql5.6.12/bin:/c/Program Files/Or
alBox:/c/Program Files/Java/jdk1.7.0_51/bin:/c/Program Files/eclipse
这是因为我正在尝试登录Git Bash
。我找到了调用Git Bash
的快捷方式:
`/bin/sh --login -i`
正在试验。这一行调用Git Bash
启动时调用的所有脚本,但是,正如您可能想象的那样,它在已调用的脚本上调用它们,因此任何文件都添加到PATH再次添加 。