#!/bin/rc
# walk -- walk the directory tree
# authors: Steve Hemminger <sch@postman.ncube.com>, Peter A. Cejchan <pac@plan9.cz>
# usage: walk dir cmd
# e.g.:
# walk wrk 'pwd; grep -n special *.[ch] '
# walk wrk 'pwd; ls -l '
rfork e
if (~ $#* 0) {
echo 'usage: walk dir cmd ' >[1=2]
exit usage
}
d=$1
shift
cmd=$*
#for (f in `{du $d | awk '{print $2}'}) {
for (f in `{w $d}) {
@{ cd $f; { eval $cmd >[2] /dev/null }}
}
|