每当我尝试在 Ubuntu 或其衍生产品之一上使用 RVM 时,我都会收到以下错误:
grep: invalid option -- 'p'
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
我查了一下type grep,得到了
grep is /bin/grep。所以 grep 没有别名。
这是 RVM 中的已知错误吗?如果不是,还有什么可能导致这种行为?
编辑:这发生在我source ~/.bash_profile. 当我只运行 RVM 相关部分时,我已经去复制了该行为。
我间歇性地有完全相同的症状:
$ grep anything *
grep: invalid option -- 'p'
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
Run Code Online (Sandbox Code Playgroud)
在我的情况下,它实际上是该目录中的一个文件,以-:
$ ls ./'-'*
./-p
Run Code Online (Sandbox Code Playgroud)
我的解决方案只是删除文件:
$ rm ./"-p"
$ ls ./'-'*
ls: cannot access ./-*: No such file or directory
$ grep anything *
grep: *: No such file or directory
Run Code Online (Sandbox Code Playgroud)