On Tue, Apr 20, 1999 at 12:47:20PM +0200, Gero Treuner wrote:
> If you choose to store your alias definitions in a single file, you
> could write a macro which picks up the new alias from the alias_file
> and calls a script to edit your sourced file, or a script which
> updates your alias file by discarding the first of duplicate entries.
Here's a script to do that. Just do:
mutt-alias-dedupe < your-alias-file > your-new-alias-file
It is safe to do:
mutt-alias-dedupe < your-alias-file > your-alias-file
as the new file is not written until the old one is completely read.
The reason for the odd edit-in-place thing is that I have my aliases
grouped into sections (work, friends, etc) and I wanted to keep that
ordering.
David
--
David Shaw | [EMAIL PROTECTED] | WWW http://www.jabberwocky.com/
+---------------------------------------------------------------------------+
"There are two major products that come out of Berkeley: LSD and UNIX.
We don't believe this to be a coincidence." - Jeremy S. Anderson
#!/usr/bin/perl
while(<>)
{
$aliases.=$_;
chop;
if(($name)=/^alias\s+(\w+)/i)
{
if($alias{$name})
{
print STDERR "$name already exists ($alias{$name})\n";
$aliases=~s/$_\n//;
$aliases=~s/$alias{$name}/$_/;
}
else
{
$alias{$1}=$_;
}
}
}
print $aliases;