aliasã¨ã·ã§ã«é¢æ°ã®éãã«ã¤ãã¦ã®ã¡ã¢ã
ãã¨ãã°grepã³ãã³ãã常ã«ãã±ã¼ã«éä¾åã«ã¦æ±ãå¦çãé«éåããã«ããããä¸è¦ã次ã®äºã¤ã®å®ç¾©ã¯åçã«è¦ããã
alias grep='LC_ALL=C grep --color=auto'
grep() { LC_ALL=C command grep --color=auto "$@" }
ãããããããã¯å®éã¯ç°ãªãã å ·ä½çã«ã¯ãaliasã¯ã¤ã³ã¿ã©ã¯ãã£ãã¢ã¼ãã®å ´åã®ã¿æ©è½ããã·ã§ã«é¢æ°ã¯éã¤ã³ã¿ã©ã¯ãã£ãã¢ã¼ãã«ããã¦ãåç §ãããã ã¾ããååã®ã·ã§ã«é¢æ°ã¨ã¨ã¤ãªã¢ã¹ãåå¨ããå ´åãã¾ãã¨ã¤ãªã¢ã¹ãå±éãããå¾ãã·ã§ã«é¢æ°ãå®è¡ãããã
ãããã£ã¦ã常ã«ã³ãã³ããã®ãã®ãç½®ãæãããå ´åã¯ã·ã§ã«é¢æ°ã端æ«ããå®è¡ããå ´åã®ã¿ç½®ãæãããå ´åã¯aliasã使ããã¨ã好ã¾ããã ãã¨ãã°ãgrepã«ããã¦ãã±ã¼ã«ã¯å¸¸ã«ç¡è¦ããããè²ä»ãã¯ç«¯æ«ã«åºåããå ´åã®ã¿èæ ®ããããªãã次ã®ããã«ããã
alias grep='grep --color=auto' grep() { LC_ALL=C command grep "$@" }
ããã§ãã·ã§ã«é¢æ°ã«ããã¦é¢æ°å ã®ã³ãã³ãã¯ä¸ã¤ã®ã¿ã§ããã®ã§ãexit statusãæ示çã«è¿ãå¿ è¦ã¯ãªãã
ãã£ã¨ããgrep --color=auto
ã¯æ¨æºåºåã端æ«ãã©ããã確èªããã®ã§ãå®ç¨ä¸ã¯ãã¹ã¦ã·ã§ã«é¢æ°ã«ã¾ã¨ãã¦ãã¾ã£ã¦ãåé¡ã¯ãªãã
grep() { LC_ALL=C command grep --color=auto "$@" }