Re: environment variable
Romano Giannetti <[email protected]>
| Newsgroups | gmane.comp.tex.tetex.general |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Feb 26, 2005 at 10:40:59AM +0100, Thomas Esser wrote:
> > Some years ago I had been experimenting with things like this and it
> > worked indeed. It didn't work with arbitrary variables, but in this
> > case $HOME is part of the filename.
>
> It works up to teTeX-2.0.2. Variables which the kpathsea library expands
> correctly can be used.
Well, another possibility is to use the --shell-escape on un*x system...
Suppose you have in ./do-env the following:
#!/bin/sh
#
rm -f tmp.tex
echo "\\def\\HOME{$HOME}" > tmp.tex
then from latex (called with --shell-escape) you could do
\immediate\write18{./do-env}
\input{tmp.tex}
HOME is \HOME\par
and this works. I know, it a bit dangerous to enable the shell escape
mechanism.
It would be nice (and safe) to be able to process the file
"/proc/self/environ" (a null-separated strings with all the environment
variable) to automatically have \HOME, \PWD etc defined but that's way out
of my texhacker possibility (and off-topic here, too...)
HTH
--
Romano Giannetti - Univ. Pontificia Comillas (Madrid, Spain)
Electronic Engineer - phone +34 915 422 800 ext 2416 fax +34 915 596 569