<<< Date Index >>>     <<< Thread Index >>>

Re: Automated subscribe/from/record setup script help



* David Yitzchak Cohen <lists+mutt_users@xxxxxxxxxxxxxx> [2003-11-01 16:00 
-0900]:
> BTW - For the find(1) example, you may want to use the -name "."
> arguments to avoid listing the entire directory if you're just trying
> to see whether or not it exists.

Sorry for the late reply, RLs been busy lately.  I'm currently using
'echo' for the directory discovery, and 'find' for the file discovery.
Reason is that echo is so much faster than ls/find that not using it for
the listing of directories would be just wrong.

Note the MDIRS line in the following (echo), and the FILE line (find):

#v+
#!/bin/sh
cd "$HOME"
MDIRS=`echo Maildir/.lists.*`
for DIR in $MDIRS
do
  unset LIST

  FILE=`find "$DIR"/cur/ | tail -1`
  for PAT in "^delivered-to: mailing list " "^x-beenthere: " 
"^list-unsubscribe: <mailto:"; "^sender: "
  do
    LIST=${LIST:=`sed -n "/$PAT/Ip" ${FILE}`}
  done

  if [ "$LIST" != "" ]
  then
    MLST=`echo "$LIST" |sed -r 's/.+(<)?.+[: ](owner-)?//; 
s/-request(@.+)\?.+/\1/'`
    echo "subscribe $MLST"
  fi

  DIR=`echo "$DIR" | sed 's/.\+\/\.//'`
  echo "folder-hook +$DIR set from=dave-`echo ${DIR} |sed 
's/\./-/g'`@weller-fahy.com"
  echo "folder-hook +$DIR set record=+$DIR"
done
#v-

Regards,
-- 
dave [ please don't CC me ]