Great, Thanks!
Dan
On Tue, May 22, 2001 at 05:59:49PM -0400, Mr. Wade wrote:
> Dan Cardamore wrote:
> > I know I've seen this before on the mutt mailing list before, but I
> > can't find the email.
> >
> > I want to update my .signature file when I send an email to contain the
> > output of a command which grabs my uptime. I'd also like to update a
> > header with content from uptime.
> >
> > Can someone help me out with this?
>
> I think that it's a bit unnecessary to include it in both the
> body and the headers,... but to each his own, I guess. :)
>
> In the initialization file, the output of Unix commands can be
> substituted using backquotes (``). (Only the first line of output
> is actually substituted.) So,... you could do something like
> this:
>
> my_hdr X-Uptime: `uptime`
>
> I have in the past used this:
>
> my_hdr X-Operating-System: `uname -smr` `uptime \
> | sed 's/.*\(up.*\),\ \+[0-9]\+\ user.*/\1/'`
>
> Of course, the uptime thus generated is the uptime when Mutt was
> started, NOT the uptime of when the message was sent. If you
> have Mutt running for hours as you write multiple messages, the
> headers will all indicate the same uptime. You could stick it in
> a send-hook, I guess, to eliminate that problem, but it's not a
> good fix, since message headers will still indicate uptimes of
> when the message composition was commenced,... even if it was
> days earlier due to postponement. I've solved this problem by
> not using Mutt configuration files to generate the header.
> Instead, I pass all outgoing email through a short script that
> uses formail to stick the header in immediately before passing it
> to sendmail for delivery.
>
> As far as the uptime in the signature, recall that if the value
> of the $signature variable ends with a pipe ("|"), it will be
> executed as a shell command and the signature will be read from
> the command's stdout.
>
> So,...
>
> set signature='echo -n "Uptime: "; uptime|'
>
> or even,
>
> set signature='echo -n "Uptime: "; uptime \
> | sed "s/.*up\(.*\),\ \+[0-9]\+\ user.*/\1/"|'
>
> ... well, you get the idea! =)
>
> I hope this helps.
>
> -- Mr. Wade
>
> --
> Linux: The Choice of the GNU Generation
>
>
________________________________________________________________
Dan Cardamore [EMAIL PROTECTED] http://www.hld.ca