On Fri, Sep 05, 2008 at 03:12:53AM -0700, Jeremy Chadwick wrote:
> Also, some folks on #bsdports asked why I was bothering with this in the
> first place: mutt supports backticks to run shell commands inside of
> a muttrc file.  See "Building a list of mailboxes on the fly" below:
> 
> http://wiki.mutt.org/?ConfigTricks
> 
> Note the find ... -printf '%h ' method.  I can accomplish (just
> about) the same using `echo $HOME/Maildir/*`, but if I want to
> exclude an entry, I can't use | grep -v, because mutt doesn't support
> pipes within backticks.  :-)

Follow-up:

mutt's backtick support does in fact respect pipes.  My echo|grep -v was
doing exactly what I requested: the grep -v was removing all output of
the echo, since echo returned the results in a space-delimited format,
not one per line.  Hence, "mailboxes" was being executed without any
arguments.

Equally as frustrating, mutt's backtick support will only honour the
first line of input.  If a backticked command returns multiple lines,
only the first is read; the rest are ignored.  This makes using BSD find
annoying, since find always outputs results terminated with a newline.
One of my peers uses find | perl -ne 'chomp; print "=", $_, " "' to deal
with this limit, which is quite disgusting.

I realise there are workarounds for the dilemma (e.g. write a shell
script that provides the exact output needed), but it seems like one
could kill two birds with one stone by extending BSD find to support
-printf, which does not output a newline unless \n is used within the
output formatting.  (This also explains why the Mutt Wiki entry uses
-printf '%h ', note the space.)

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |

_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to