-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update grep.sh #2
base: master
Are you sure you want to change the base?
Conversation
Modifying to remove the references to the now deprecated `GREP_OPTIONS` which throws a deprecation warning.
my_grep_options=(
...
)
|
Removing per comment on related PR zannalov#2 Update to prevent GREP_OPTIONS deprecation warnings.
Do you mean like this in
Or did you mean like this...
|
Per the PR zannalov#2 feedback from @zannalov: Improve source for readability. Fix invalid variable reference in alias command string. Unset at end of execution.
@zannalov This is operating as expected on my local installation and I believe it addresses all the issues you surfaced in the PR comments. Let me know if you need any other changes on this sir. |
${my_grep_options[@]} --exclude-dir=.cvs) # Excludes .cvs directories for CVS | ||
${my_grep_options[@]} --exclude-dir=.git) # Excludes .git directories for Git | ||
${my_grep_options[@]} --exclude-dir=.hg) # Excludes .hg directories for Mercurial | ||
${my_grep_options[@]} --exclude-dir=.svn) # Excludes .svn directors for Subversion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Syntax error, too many closing parenthesis (one per line)
Additionally (if it weren't for the syntax error) this would result in --color=auto --exclude-dir=CVS --color=auto --exclude-dir=.cvs --color=auto --exclude-dir=.git --color=auto --exclude-dir=.hg --color=auto --exclude-dir=.svn
-- You only need ${my_grep_options[@]}
once up-front.
${my_grep_options[@]} --exclude-dir=.svn) # Excludes .svn directors for Subversion | ||
) | ||
alias grep="grep $my_grep_options" | ||
unset my_grep_options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two lines should be outside the if-block so that --color=auto
is applied even if --exclude-dir
isn't supported.
${my_grep_options[@]} --exclude-dir=.hg) # Excludes .hg directories for Mercurial | ||
${my_grep_options[@]} --exclude-dir=.svn) # Excludes .svn directors for Subversion | ||
) | ||
alias grep="grep $my_grep_options" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using the same ${my_grep_options[@]}
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow since this conflicts with your initial feedback sir:
so it would be better to write alias grep="grep ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I think I see what you mean. Instead of the $my_grep_options
use ${my_grep_options[@]}
...right?
Modifying to remove the references to the now deprecated
GREP_OPTIONS
which throws a deprecation warning.