diff options
Diffstat (limited to 'bin/rgl')
-rwxr-xr-x | bin/rgl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/rgl b/bin/rgl new file mode 100755 index 00000000..03f1ba71 --- /dev/null +++ b/bin/rgl @@ -0,0 +1,17 @@ +#!/bin/sh +# Read grep(1) patterns from input and search for them in the given files + +# Check the arguments +if [ "$#" -eq 0 ] ; then + printf >&2 'rgl: Need at least one filename\n' + exit 2 +fi + +# Iterate over the patterns and search for each one; if the input is a terminal +# include a slash prompt for the next pattern +while { + [ -t 0 ] && printf / + read -r pat +} ; do + grep -- "$pat" "$@" +done |