简体   繁体   中英

OSX Terminal - application listed by 'which' does not run by default

I followed instructions on this page to change the profile of the Mac terminal when I'm running SSH. The short explanation is that it puts a wrapper script in /usr/local/bin that changes the colour then calls /usr/bin/ssh . When I call this script with the full path it works perfectly, but when I call ' ssh ', it appears to use the regular application without the wrapper script.

When I call ' which ssh ', the result is ' /usr/local/bin/ssh '. My PATH variable is ' /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin ', which looks fine for me. The wrapper script has executable permissions ('-rwxr-xr-x ').

What am I missing? Why would the regular ssh be called rather than than the wrapper script, given the ' which ' command points to the one that I want?

您忘记清除bash的程序位置缓存。

hash -d ssh

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM