which ã³ãã³ã
- which ã³ãã³ã
- which ã³ãã³ãã«ã¤ãã¦
- ãããã which ã³ãã³ãã£ã¦ï¼
- which ã³ãã³ããæ´ã«è¿½æ±ãã
- which ã³ãã³ã㧠æ¤ç´¢ã« alias ãå«ããã
- which ã³ãã³ãã®æ¤ç´¢ã« function ãå«ããã
- alias ã function ãã©ã¡ããæ¤ç´¢å¯¾è±¡ã«ãããã
- ååã®ã³ãã³ãããã¹ã¦åæãã
- ã¶ã£ã¡ãã type ã§ãããï¼
- which ã®æ´»ç¨æ³
- which ã ãããããããªããã®
- which -a ã§å ¨é¨
- ãªãé¡ä¼¼ã«ã³ãã³ãã« whereis ãããã¾ãã
- åèè³æ
- é¢é£è¨äº
- 2019-08-23
which ã³ãã³ãã«ã¤ãã¦
which ã³ãã³ãã¯ããã£ã¦ãããã¾ãã§ãç¹ã«è©³ãã調ã¹ããã¨ãããªãã£ããä»åã¯which ã³ãã³ããè¦ç´ãã¦ã¿ããã¨ã«ããã
ãããã which ã³ãã³ãã£ã¦ï¼
which ã³ãã³ãã¯ãæå®ãããã³ãã³ããPATHã®ä½å¦ã«åºç¾ããã調ã¹ã¦ãããã
å©ç¨å ´é¢ã¯ãæ¤ã®ã³ãã³ãã©ãã«ãããã ã£ãï¼ã¨ãã«ã¤ãããwhich PATH is this comand in ?
ã®çåã«çãã¦ãããã
ãã¨ãã°ã次ã®ããã«ä½¿ãã
takuya@~$ which bash /usr/local/bin/bash
which ã³ãã³ããæ´ã«è¿½æ±ãã
ãæ¤ã®ã³ãã³ãã©ãã«ï¼ãã®ããã®ã³ãã³ããã®å®ç¾©ãåºããããä½ãããªãã¨ãPATHãæ¢ãã®ã ãã ããã©ãã³ãã³ãã¯ãã¡ã¤ã«ã¨ã¯éããªããfuntion
alias
ãã³ãã³ãã¨ãã¦æ©è½ãã.ããããæ¢ããã®ã which
ã ãã©ããã®æ¤ç´¢ç¯å²ã¯ãé常ã«éããã¦ããã詳細ã«æå®ãã¦ãããªãã¦ã¯ãããªãã
which ls
ããã 㨠PATHããæ¢ãã¦ãããã ãã ã
ãã®ls ã¯ä½ã®ï¼ which is ls
ãã®ãããls ã¨ãã£ã¦ããå®éã«ä½¿ã£ã¦ããls
ã¯ã©ãã ï¼ããã®ç®çã ã¨ãtype
ã³ãã³ããç¨ãã¦ç¢ºèªãããã¨ãå¤ãã®ã ã
takuya@~$ type ls ls 㯠`ls --color=auto --time-style=long-iso ' ã®ã¨ã¤ãªã¢ã¹ã§ã
ãªã®ã§ãwhich ã使ãå ´é¢ã¯éããã¦ãæ®ã©ã®å ´å type
ã³ãã³ãã§æ¸ã¾ãããã¨ãå¤ãã®ã ãã¨ããããå®ç´ãªææ³ãè¨ãã°ãtype ä¸è½ãtype ä¸æ³ãã§ãä»åã¯ãã³ã¬ã which ã§ãããã¨ãåºæ¥ããã¨ãç¥ã£ãã®ã§ããã¡ã¦ããã®ã ã
which ã³ãã³ã㧠æ¤ç´¢ã« alias ãå«ããã
ã¨ã¤ãªã¢ã¹ãå«ããã«ã¯ãwhich ã«æ¨æºåºå㧠ã¨ã¤ãªã¢ã¹ã®ä¸è¦§ãä¸ãã¦ã --read-alias / -i
ãªãã·ã§ã³ãä»ããã®ã ã
alias | which --read-alias ls
å®è¡çµæ
takuya@~$ alias | which --read-alias ls alias ls='ls --color=auto --time-style=long-iso ' /Users/takuya/.bin/ls
which ã³ãã³ãã®æ¤ç´¢ã« function ãå«ããã
function ãå«ãããã¨ãåºæ¥ãã declare -f
ã§é¢æ°ä¸è¦§ãåãåºãã¦ã--read-functions
ã使ã£ã¦which ã®æ¤ç´¢ã«é¢æ°ãå«ãããã¨ãåºæ¥ãã
declare -f | which --read-functions find
å®è¡ä¾
takuya@~$ declare -f | which --read-functions find -a find () { #ç¥ }
alias ã function ãã©ã¡ããæ¤ç´¢å¯¾è±¡ã«ãããã
alias ã function ã PATH ãã¾ã¨ãã¦ãå
¨ã¦ããããã³ãã³ãã®åå¨ã調ã¹ããã ãã®æå³ã 㨠( alias; declare )
ã¨ãµãã·ã§ã«ã§ï¼ã¤ãåæã«ä¸ããã
(alias;declare -f) | which --read-alias --read-functions--read-functions # ã¾ãã¯ã°ã«ã¼ãåã§ã { alias;declare -f; } | which --read-alias --read-functions find
å®è¡ä¾
takuya@~$ (alias;declare -f) | which --read-alias --read-functions ls alias ls='ls --color=auto --time-style=long-iso ' /Users/takuya/.bin/ls
ããã¾ã§ãããªãããã type 使ãããï¼ãã¼
ååã®ã³ãã³ãããã¹ã¦åæãã
-a
ãªãã·ã§ã³ãä»ããã
å®è¡ä¾
takuya@~$ which -a bash /usr/local/bin/bash /bin/bash
ã³ãã³ããä½å¦ã«ããã調ã¹ãæå³ã 㨠-a
ã®ãªãã·ã§ã³ãä¸çªè¯ããã
ã¶ã£ã¡ãã type ã§ãããï¼
調ã¹ãã ããªããtype ã§ãããã§ããtype ã§ã
å人çã«ã¯ã which 㯠ã³ãã³ãã®æ¢ç´¢ ã type ã¯ã³ãã³ãã®å¤å¥ã«ä½¿ã£ã¦ãã¾ãããã ã使ãåããªãã¦ã which ã ãã§ãååç¨éã«è¶³ãããã ãã¨æå¿ãã¦ã¾ããã
which ã®æ´»ç¨æ³
which 㯠type ã¨éããã³ãã³ãã®ãã«ãã¹ãè¿ã£ã¦ããå¹æãããã¾ãããããå©ç¨ãã¦ããã«ãã¹æå®ã³ãã³ãã§å ´æãããããªãã¨ããªã©ã«ã¨ãããã which ãã¦ããã°ä¾¿å©ã§ããã
$(which find) -type d
ã¾ããã¡ãã env
ã³ãã³ãããããã env ã§ãããã§ããã. env ã ã¨å¼æ°ãä¸ãããã¾ããããããããå®è¡æ¹å¼ãéããã ã
## ã§ãã $(env find) $(which find) -type d $(which find) -type d ~/Desktop ## ã§ããªã $(env find) -type d ~/Desktop
which ã ãããããããªããã®
which ã ããã足ããªããã¨ãããã
é¢æ°ã¯ãããã¾ãããã·ã³ããªãã¯ãªã³ã¯ã¯ãã©ã£ã¦ããã¾ããã
é¢æ°ã¯è¦ããªãã
takuya$ function grep { echo ... ; } takuya$ which grep /bin/grep
é¢æ°ã¯è¦ããªãã®ã§åè¿°ã®éã type ã使ãã¾ãããã
ãã«ãã¹ã¯è¦ããªãã
ã·ã³ããªãã¯ãªã³ã¯ããã¦ããã³ãã³ãã®å®ä½ãã¹ã¯ãã¡ããè¦ãã¾ããã home brew ã®ããã«ã³ãã³ããã¡ã¤ã«ãsym link ã«ããã¦ãã®æãããã®ã ã
takuya@~$ which gls /usr/local/bin/gls takuya@~$ realpath /usr/local/bin/gls /usr/local/Cellar/coreutils/8.26/bin/gls
ãã®ããã«å®ä½ãã¡ã¤ã«ãç¥ãããã¨ãã«ã¯ã realpath ( ã¾ã㯠readink) ãéãããããå¿ è¦ãããã
readlink $(which gls)
ããã¯ããã©ãããã®ã§ãã·ã§ã¼ãã«ããã«ãã¦ããã¨ä¾¿å©
function which-realpath(){ realpath $( which $@ ) }
which -a ã§å ¨é¨
ããã確ãã¤ã³ã¹ãã¼ã«ããã¯ãã ãã©ããã¹ãããããã®ãã¨ããååã®ã³ãã³ããããã¤ãããã¨ãã«ããã¹ã®åªå é ä½ã調ã¹ãã¨ã whereis / which --all ã便å©ã§ãã
which -a node which --all node
ãªãé¡ä¼¼ã«ã³ãã³ãã« whereis ãããã¾ãã
whereis ã¨ããã³ãã³ãã§ãé¡ä¼¼ã®ãã¨ãåºæ¥ã¾ãã
ãã ãwhereis 㯠ããã« locate ã®ä»£ããã«ãªãã¾ããã³ãã³ããã®ãã®ãæ¢ãããã§ã¯ããã¾ããã
windows ã 㨠where ã§ããã
whatis / who / which / whereis / whoami / while ãªã© whããå§ã¾ã ã³ãã³ãã¯ä½ãã¨ä¾¿å©ã ã
åèè³æ
- man which ( GNU which )
é¢é£è¨äº
which コマンドでPATHにある同名のコマンドを全部列挙する - それマグで!
2019-08-23
è¨è¿°ãä¿®æ£