#! /bin/sh LC_ALL=C export LC_ALL IFS=' ' pattern='(expand|head|fold|split|tail|uniq|unexpand|nice|diff)\>.*[ ]-[a-zA-Z]*[0-9]|(sort|tail|uniq)\>.*[ ]\+[0-9]+[a-zA-Z_]*|sort\>.*[ ]-o' case $1 in --help) exec echo "$0: usage: $0 [OPTION]... [FILE]... Grep for instances of possible POSIX-conformance problems in the FILEs. Options: -s Check strictly, even for things that aren't likely to be real problems. The FILEs can be directories, in which case the greps are recursive, though ChangeLogs, backup files, and version-control histories are bypassed. The default FILE is '-', which stands for the standard input.";; -s) pattern=$pattern'|[ef]grep\>|(\[|test\>).*[ ]-[ao]\>' shift;; esac pattern='\<('$pattern')' case $# in 0) exec grep -E -n "$pattern";; *) find "${@-.}" -type f \ ! -name '*~' ! -name 'ChangeLog*' ! -name '*,v' \ -print \ | sort | xargs grep -E -n "$pattern";; esac