Every grep command returns "grep: invalid option -- '='" [closed]
Mia Lopez
I've already removed and reinstalled grep on Ubuntu but still the same error persists.
Whatever grep` command I type I always see the following output:
grep: invalid option -- '='
Usage: grep [OPTION]... PATTERN [FILE]...
Try grep --help for more information.`So even
grep -Vresults in this error, or
grep --helpsame thing!
/bin/grep has the same byte size as it does on my other identical hosts, where it works fine, so it's likely to be some environmental variable or local setting.
Any ideas?
24 Answers
In case this isn't yet fixed, see if there is any file in the directory that starts with a '-'.
Helped me.
2Sounds like you have an alias to grep, which is adding invalid arguments. Try the following:
type grepthis will tell you if the grep command is an alias or not. If it is, check your .profile, .bash_profile and .bashrc files for where this alias is defined.
I think you need to use:
grep -e "=" 2 its because there's a file in the directory starting with -
example 1:
touch ./-mike.txt
ls
-mike.txt
grep -i blah *
grep: invalid max countexample 2:
touch ./-sike.txt
grep -i blah *
grep: invalid option -- 'k'
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.solution remove files starting with - , example:
rm ./-sike.txt 1