🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.mail.mush
Article #516

Problem setting headers to output from shell commands

#516
From: Matthew Farwell
Date: Fri, 21 Sep 1990 09:10
64 lines
2229 bytes
Ok. This may seem a silly question, but I have RTFM'd, and I can't see
an easy + simplistic answer.

I want to include the output from a shell command in a header.
Say I wanted to produce a header like

X-My-Date: Fri Sep 21 09:53:09 BST 1990
where
this would be the output from something approaching
my_hdr X-My-Date: `sh date`

How would I go about it?
What I have tried is using a shell function as a workaround, in the hope
of someone providing me a better solution.

mush()
{
	tmpfile=/tmp/mu.$$
	echo my_hdr X-My-Date: `date` > $tmpfile
	/usr/local/bin/mush -C -F $tmpfile $*
	rm $tmpfile
}

Even this doesn't work properly. It adds the extra header as long as you
enter the shell before you start sending mail. I've tried things like
testing is_sending, but that doesn't seem to work either.

Any ideas? I'm running Mush 7.1.2 under Sco Xenix 2.3.1. Here is my .mushrc
-----
if hdrs_only
	exit
endif
set ask
set autoedit
set autoinclude
set autombox
set autosign
set complete
set dot
set edit_hdrs
set folder=~/mail
set history=30
set hostname=ibmpcug.co.uk
set in_reply_to='%i from %n'
set indent_str=>
set mbox=~/mail/mbox
set pager=internal
set pre_indent_str='In message dated %W %N %M, %f writes:'
set realname='Matthew Farwell'
set record=+outgoing
my_hdr X-Bogus-Mail-Header: Strawberry shortcake
my_hdr X-Coffee-Cup: Sun Microsystems
# some aliases here...
bind '=' macro '(~/mail/savelists\n'
------

Dylan.

p.s. `date` is only used as an example. I want a generic way of doing things.
-- 
Matthew J Farwell                 | Email: dylan@ibmpcug.co.uk
The IBM PC User Group, PO Box 360,|        ...!uunet!ukc!ibmpcug!dylan
Harrow HA1 4LQ England            | CONNECT - Usenet Access in the UK!!
Phone: +44 81-863-1191            | Sun? Don't they make coffee machines?
Technical Details
Message-ID: <1990Sep21.091000.11589@ibmpcug.co.uk>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ukc!slxsys!ibmpcug!dylan

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ukc!slxsys!ibmpcug!dylan
From: dylan@ibmpcug.co.uk (Matthew Farwell)
Newsgroups: comp.mail.mush
Subject: Problem setting headers to output from shell commands
Message-ID: <1990Sep21.091000.11589@ibmpcug.co.uk>
Date: 21 Sep 90 09:10:00 GMT
Sender: dylan@ibmpcug.co.uk (Matthew Farwell)
Organization: The IBM PC User Group, UK.
Lines: 64