#!/bin/rc
rfork e
opth=n
if (! ~ $#1 0 && ~ $1 -h){
opth=y
shift
}
if (~ $#* 0){
echo usage: Mg [-h] args >[1=2]
exit usage
}
msgs=`{cat /tmp/msgs.$user |
grep '.*/[0-9]*/(.\.)?[0-9]*(/.*)?$' |
sed -e 's|((.*/)?[0-9]*/(.\.)?[0-9]*)(/.*)?|\1/text|'}
for (m in $msgs){
if (~ $opth y){
if (sed '/^$/q' $m | grep -s $*)
echo $m
}
if not {
if (grep -s $* $m /dev/null)
echo $m
}
}
exit ''
|