shithub: binrc

ref: 5cb4b786139c7e3ad5df18d5d7edc56634d111a0
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 $*}