1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 06:39:02 -08:00
rc/sh/grop
Connor Olding d5f3f14d72 merge compatibility lines
RIP meaningful last-modified dates
2024-03-26 15:08:14 -07:00

14 lines
447 B
Bash
Executable file

#!/usr/bin/env sh
# YES_ZSH YES_BASH YES_DASH YES_ASH
# TODO: check for existence of grep -P; write a perl-based fallback.
grop() { ### @- invoke grep with `-oP`.
### **NOTE:** there also exists a grop(1) program provided by
### the *grop* package that i don't use.
argc $# -ge 1 grop || return
grep -oP -- "$@"
}
[ -n "${preload+-}" ] || . ~/sh/preload || exit 2
eval ${preload:-preload} argc
[ -n "${preload+-}" ] || grop "$@"