Re: automating the lbdb queries?
On Thu, Oct 31, 2002 at 03:40:02PM +0100, martin f krafft wrote:
<snip>
> both these methods work with aliases perfectly, now I would like them
> to do the same thing with the query_command.
>
> i.e.:
>
> starting mutt from the command line as
> mutt pan
>
> should execute
> lbdbq pan
>
> and use the resulting line to address the mail to Peter Pan
> <peter@pan.com>.
>
> is this possible with mutt? how?
I haven't used lbdb myself, but generally speaking, this sounds like a
job for bash. how about
mutt `lbdb pan`
should pass the output of "lbdb pan" as the parameter to mutt, or if the
lbdb command has multiple columns of output, and you want only column 1
mutt `lbdb pan | awk '{print $1}'`
again, not knowing the specifics of lbdb, this might just be a
worthless, ignorant response, but generally speaking, this is a useful
way to pass the result of one program as a parameter to another.
ok, out of curiosity, I just installed the package, and this command
line Works For Me
mutt `lbdbq mrroach | tail -n1 | awk '{print $1}'`
if you then put this function definition in your ~/.bashrc
function mutt {
/usr/bin/mutt `lbdbq $1 | tail -n1 | awk '{print $1}'`
}
now you can run "mutt pan" from a shell and have pan automatically
expanded for you. Hey, how bout that, I think I actually answered the
question :) That hardly ever happens.
-Mark
Reply to: