#!/bin/rc
rfork e
fn order{
ns | awk '
$NF == "'^$1^'" {
if(n == 0 || NF == 3) {
n++;
i = 0;
min=-1;
max=1
}else if($2 == "-b")
i=min--;
else
i=max++;
t[i] = $(NF-1);
}
END{
for(i=min+1; i<max; i++)
print t[i];
}'
}
fn u{
awk '
{
t[$1] = 1;
}
END{
for(i in t)
print i
}'
}
for(i)
{for(j in $path){
p=$j
if(~ $p .)
p = `{pwd}
for(k in `{order $p})
if(test -f $k/$i)
echo $k/$i
}}|u
|