使用 command 命令暂时忽视 alias

June 03, 2017

我们经常会为某个命令设置 alias,比如我在 zsh 中设置了

alias diff="icdiff"

(icdiff 是一个加强版的 diff)

which diff
diff: aliased to icdiff
➜  diff
Usage: icdiff [options] left_file right_file

Show differences between files in a two column view.

Options:
  --version             show program's version number and exit
……

如果想暂时忽略 alias,使用系统自带的 diff,则可以在前面加上 command 命令:

command diff --help
Usage: diff [OPTION]... FILES
Compare files line by line.

  -i  --ignore-case  Ignore case differences in file contents.
  --ignore-file-name-case  Ignore case when comparing file names.
……

Reference


Profile picture

Written by Armin Li , a venture capitalist. [Weibo] [Subscribe]