Anonymous Mail

Steve Minneman stevem at fai.UUCP
Sat Nov 15 04:20:07 AEST 1986


As Tony Hansen pointed out to me, although the script I submitted to cope
with the anonymous mail question worked if it was executed without a . in
front, there was an error.  The text of his message to me pointing out the
problem and suggesting an even better solution follows:

**************************************************************************

There are a couple of things wrong with your sample script:

SAVE1='LOGNAME'

This sets the value of the variable SAVE1 to the string "LOGNAME" and NOT
the value of the environment variable $LOGNAME. To do that you would want:

SAVE1="$LOGNAME"

Note the use of double quotes and the use of the dollar-sign.

Also, there is no need to save and restore the environment variables since
this code would presumably be placed in a separate script to be executed and
not dotted. Any changes made to environmentu variables in subshells have no
effect on the values within the parent shell.

I would probably write the code as follows:

LOGNAME='proper!unknown!poster' NAME='I. A. M. Anonymous' mailx $1

Placing the variable settings on the same line as the invocation of mailx
will cause them to only be set and exported for that command.

					Tony Hansen
					ihnp4!pegasus!hansen


-- 

		Steven A. Minneman (Fujitsu America Inc, San Jose, Ca)
		!seismo!amdahl!fai!stevem  or !ihnp4!pesnta!fai!stevem

The best government is no government at all.



More information about the Comp.unix.questions mailing list