2010-01-16 13:50:22 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
gitgrep()
|
|
|
|
{
|
|
|
|
local out=$(git grep -I -E -n "$1" | \
|
|
|
|
grep -E '^(bash_completion|contrib/|test/)' | \
|
|
|
|
grep -Fv 'test/runLint')
|
|
|
|
if [ -n "$out" ] ; then
|
|
|
|
printf '***** %s\n' "$2"
|
|
|
|
printf '%s\n\n' "$out"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-01-16 15:54:28 +02:00
|
|
|
unset CDPATH
|
|
|
|
cd $(dirname "$0") ; cd ..
|
|
|
|
|
2010-01-16 13:50:22 +02:00
|
|
|
gitgrep "\bawk\b.*-F([[:space:]]|[[:space:]]*[\"'][^\"']{2,})" \
|
|
|
|
'awk with -F char or -F ERE, use -Fchar instead (Solaris)'
|
|
|
|
|
|
|
|
gitgrep '\bsed\b.*\\[?+]' \
|
|
|
|
'sed with ? or +, use POSIX BRE instead (\{m,n\})'
|
|
|
|
|
2010-01-16 15:15:06 +02:00
|
|
|
gitgrep '\bsed\b.*\\\|' \
|
|
|
|
"sed with \|, use POSIX BRE (possibly multiple sed invocations) or another tool instead"
|
2010-01-16 13:50:22 +02:00
|
|
|
|
|
|
|
# TODO: really nonportable? appears to work fine in Linux, FreeBSD, Solaris
|
|
|
|
#gitgrep '\bsed\b.*;' \
|
|
|
|
# 'sed with ;, use multiple -e options instead (POSIX?) (false positives?)'
|
|
|
|
|
|
|
|
gitgrep '\bsed\b.*-[^[:space:]]*[rE]' \
|
|
|
|
'sed with -r or -E, drop and use POSIX BRE instead'
|
|
|
|
|
|
|
|
gitgrep '\b[ef]grep\b' \
|
|
|
|
'[ef]grep, use grep -[EF] instead (historical/deprecated)'
|
|
|
|
|
|
|
|
# TODO: $ in sed subexpression used as an anchor (POSIX BRE optional, not in
|
|
|
|
# Solaris/FreeBSD)
|