Dr. Sharukh K. R. Pavri. saw fit to inform LI that: 

>How do I make aliases for mutt so that when I type lih in the To: field the
>mail should go to the LIH list ( what I want is something akin to

As Binand said - use .mutt-aliases

BTW, here's a neat perl script I picked up to convert pine addressbooks
(.addressbook) to mutt aliases.  So you don't need the hassle of
rebuilding yr address book every time. (below my .sig)

-- 
Suresh Ramasubramanian + President, CAUCE India + www.india.cauce.org
Stopping Spam In India + [EMAIL PROTECTED] + Spammers are Losers
--
You know you've been spending too much time on the computer when your 
friend misdates a check, and you suggest adding a "++" to fix it.

-------------

#!/usr/local/bin/perl -w
# addressbook-to-alias.pl: 07/21/1998 KELEMEN Peter <[EMAIL PROTECTED]>
# Converts Pine addressbook to Mutt alias format.

use Getopt::Long;
use strict;
use vars qw($cache $opt_hook $opt_addressbook $opt_muttrc $opt_comment);

# defaults
$opt_hook = 'fcc-save';
$opt_addressbook = "$ENV{HOME}/.addressbook";
$opt_muttrc = "$ENV{HOME}/.muttalias";
$opt_comment = 0;

# process options
GetOptions('hook=s', 'addressbook=s', 'muttrc=s', 'comment!');
for ($opt_hook) {
        s/-hook$//;
        die "invalid hook: `$_'\n" unless (/^((fcc-)?save|fcc|mbox)$/);
}

# main
$opt_hook .= '-hook';
print "using hook `$opt_hook'\n";

addressbook_open();
open(MUTTRC, ">>$opt_muttrc") || die "$opt_muttrc: $!\n";
print MUTTRC "# generated by addressbook-to-alias.pl\n";
while (my $line = addressbook_read()) {
        next if ($line =~ /^#/);
        my ($nick, $full, $address, $fcc, $comment) = split(/\t[ ]*/, $line);
        if ($address =~ /\(/) { # distribution list
                for ($address) {
                        s/\s+//;
                        s/^\(//;
                        s/\)$//;
                }
                print MUTTRC "alias $nick\t$address";
                if ($opt_comment && ($full || $comment)) {
                        print MUTTRC "\t#";
                        print MUTTRC " $full" if $full;
                        print MUTTRC " $comment" if $comment;
                }
                print MUTTRC "\n";
                if ($fcc) {
                        if ($opt_hook =~ /^fcc-hook$/) {
                                print MUTTRC "$opt_hook\t$nick\t$fcc\n";
                        } else {
                                print "ignoring FCC for $nick\n";
                        }
                }
        } else { # single entry
                print MUTTRC "alias $nick\t$address ($full)";
                print MUTTRC "\t# $comment" if ($opt_comment && $comment);
                print MUTTRC "\n";
                print MUTTRC "$opt_hook\t$address\t$fcc\n" if ($fcc);
        }
}
close(MUTTRC);
addressbook_close();

sub addressbook_open {
        open(ADDR, "<$opt_addressbook") || die "$opt_addressbook: $!\n";
        $cache = <ADDR>;
}

sub addressbook_read {
        my $readline = $cache;
        GETLINE: while (defined($cache = <ADDR>)) {
                chomp $cache;
                if ($cache =~ /^[ \t]/) {
                        $readline .= $cache;
                } else {
                        last GETLINE;
                }
        }
        return $readline;
}

sub addressbook_close {
        close(ADDR);
}

-----------------------------------------------------------------------
For more information on the LIH mailing list see:
http://lists.linux-india.org/lists/LIH

Reply via email to