chore: Use grep -E / grep -F instead of egrep / fgrep (#2164)
Ensures that the -E or -F option, when used, is the first option * i.e. grep -oE => grep -E -o Updates _bash-it-grep to invoke grep with just the provided arguments * This function was (and still is) unused, but decided this new functionality was actually more useful Introduces _bash-it-fgrep to invoke grep -F Removes type -P egrep from the _bash-it-*grep functions For usages that were already going to be modified, use -F if appropriate * Does not touch grep usages that may have benefited from -F, but were not otherwise considered for this PR Adds shellcheck header to modified .bash files that didn't already have it
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
# Bash completion for Makefile
|
||||
# Loosely adapted from http://stackoverflow.com/a/38415982/1472048
|
||||
|
||||
@@ -17,7 +19,7 @@ _makecomplete() {
|
||||
for f in "${files[@]}" ; do
|
||||
while IFS='' read -r line ; do
|
||||
targets+=("$line")
|
||||
done < <(grep -oE '^[a-zA-Z0-9_-]+:([^=]|$)' "$f" | cut -d':' -f1)
|
||||
done < <(grep -E -o '^[a-zA-Z0-9_-]+:([^=]|$)' "$f" | cut -d':' -f1)
|
||||
done
|
||||
|
||||
[ "${#targets[@]}" -eq 0 ] && return 0
|
||||
|
||||
Reference in New Issue
Block a user