shithub: binrc

ref: b82b52776f6c6cb34a2bca222e3c92ac918ae517
dir: /gr/

View raw version
#!/bin/rc
# gr - recursive g(1)
# sources/contrib/stallion/rc/gr

fn usage {
	echo >[1=2] usage: gr [g options] pattern [file...]
	exit usage
}

fn findfiles {
	du -as $* |awk '{if ($2 != ".") print $2}'
}

opts=()
while(~ $1 -*){
	opts=($opts $1)
	shift
}

if(~ $#* 0)
	usage

pattern=$1; shift
g $opts $pattern `{findfiles $*}