새로 설치된 프로그램을 보려면 "어떤" 프로그램에 셸 새로 고침이 필요합니까?

새로 설치된 프로그램을 보려면 "어떤" 프로그램에 셸 새로 고침이 필요합니까?

Linux 프로그램에서 경로에 설치된 새 프로그램을 보려면 which쉘을 새로 고쳐야 하는 이유(예: tcsh터미널에 입력)는 무엇입니까?

명확하게 볼 수 있는 usr/local/bin의 다른 프로그램과 동일한 권한을 가진 프로그램에 액세스할 수 없는 이유에 대해 당황했습니다 .which

누군가 이것이 평신도의 용어로 나에게 어떻게 작동하는지 설명할 수 있습니까?

답변1

노력하다rehash

man tcsh라고

   rehash  Causes  the internal hash table of the contents of the directo-
           ries in the path variable to be recomputed.  This is needed  if
           new  commands  are  added  to directories in path while you are
           logged in.  This should be necessary only if you  add  commands
           to  one  of  your  own  directories, or if a systems programmer
           changes the contents of one of the  system  directories.   Also
           flushes the cache of home directories built by tilde expansion.

평신도의 관점에서 보면 tcsh는 빠른 응답을 제공하기를 원하므로 명령과 해당 명령을 찾을 수 있는 내부 테이블(아마도 해시 테이블)을 구축합니다. 아마도 시작할 때 이 작업을 수행하는 것 같습니다. 안타깝게도 사용자나 관리자가 해당 테이블을 업데이트해야 하는 작업을 수행할 때 이를 알아차릴 수 있는 메커니즘이 없습니다.

이것이 제가 csh 파생 상품보다 ksh나 bash를 선호하는 많은 이유 중 하나입니다.

답변2

$ which test
/usr/bin/test
$ ls ~/bin/test
ls: cannot access bin/test: No such file or directory
$ touch ~/bin/test
$ chmod 755 ~/bin/test
$ which test
/home/daniel/bin/test
$

whichBash를 사용하면 쉘 새로 고침이 필요하지 않으므로 그 자체 와 관련이 없습니다 . 다른 변수가 작용해야 합니다.

관련 정보