Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Source RVM script - "grep: invalid option -- 'p'"

Tags:

grep

ruby

rvm

Whenever I try to use RVM on Ubuntu or one of it's derivatives, I get the following error:

grep: invalid option -- 'p' Usage: grep [OPTION]... PATTERN [FILE]... Try 'grep --help' for more information.

I checked type grep, and got grep is /bin/grep. So grep is not aliased.

Is this a known bug in RVM? If not, what else could be causing this behavior?

EDIT: This occurs when I source ~/.bash_profile. I've gone and reproduced the behavior when I run just the RVM related part.

like image 353
Cody Poll Avatar asked Aug 01 '26 08:08

Cody Poll


1 Answers

I had exactly the same symptom intermittently:

$ grep anything *
grep: invalid option -- 'p'
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.

In my case it was actually a file in that directory starting with -:

$ ls ./'-'*
./-p

The solution for me was just to remove the file:

$ rm ./"-p"
$ ls ./'-'*
ls: cannot access ./-*: No such file or directory
$ grep anything *
grep: *: No such file or directory
like image 191
austinmarton Avatar answered Aug 03 '26 21:08

austinmarton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!