refact(bash_profile): Replace deprecated GREP_OPTIONS with aliases #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commit Message
| less
) without using the-R
or--RAW-CONTROL-CHARS
parameter, the output will contain control charactersinstead of coloration
(e.g
> hunters-playhouse.txt
), the output file will contain controlcharacters instead of coloration
will not contain coloration
-n
flag to display line numbersPlain English
GREP_OPTIONS
is deprecated, so it should be replaced.GREP_OPTIONS='--color=always'
is synonymous withalias grep="grep --color=always"
. This works great, but I prefer to set the color to auto instead of always.Setting the color to always will output display control characters instead of actual color if you pipe the output (unless you use
-R
) or redirect the output to another file, like in the example below.Setting the color to auto will not display color if you pipe or redirect the output, but you won't have to deal with those pesky control characters appearing.
My personal solution is to use
alias grep="grep --color=auto -n"
and create the variant I call "grep color",alias grepc="grep --color=always -n"
.Oh yeah, the
-n
flag just displays number lines in the output, which I find helpful.