procmail
[Top] [All Lists]

Showing all env vars

2005-04-20 05:32:52

This is pretty neat, I think.  I just discovered the second
thing below, by accident.


First, this one, which I've known for a while (and for which I
thank Mike Peeler):

  LOG = `env`

Sample output:

  TZ=Europe/Berlin
  LINEBUF=2048
  COMSAT=no
  LOGNAME=dman
  SHELL=/usr/local/bin/tcsh
  HOME=/net/u/1/d/dman
  PROCMAIL_VERSION=3.23pre+
  SENDMAILFLAGS=-oi
  SENDMAIL=/usr/sbin/sendmail
  SHELLFLAGS=-c
  MSGPREFIX=msg.
  LOCKEXT=.lock
  SHELLMETAS=&|<>~;?*[
  HOST=panix5.panix.com
  PATH=/net/u/1/d/dman/bin:/bin:/usr/local/bin:/usr/bin
  DEFAULT=/dev/null
  

But suppose you just want a list of all vars you've got
defined?  Well, obviously we could take the above and run
it through sed.  And then through sort.

Here's another way, though:

  SHELL = /bin/sh
  LOG = `dummy=; export $dummy`

All stripped and pre-sorted!  Here's the output:

  COMSAT
  DEFAULT
  HOME
  HOST
  LINEBUF
  LOCKEXT
  LOGNAME
  MAILDIR
  MSGPREFIX
  PATH
  PROCMAIL_VERSION
  SENDMAIL
  SENDMAILFLAGS
  SHELL
  SHELLFLAGS
  SHELLMETAS
  TZ

I'm going to use this at the end of some complex rcfiles I'm
writing in order to catalog all the vars I've created and placed
in use in that run.  Then I can use the list to write my documentation,
show what namespace I've appropriated, etc.

(Note that the above is from a new, clean rcfile that has not had
any private env vars added yet.)

-- 
dman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>