\doifdefinedelse and \write
Hello, with the following test-file I expect the output: "Yes No" But the output is: "edef @@lycurrentstate{myTestbla}No edef @@lycurrentstate{myTestblub}No" Where does this come from, and how could I get it right please? \def\myMacro#1{\doifdefinedelse{myTest#1}{Yes}{No}} \def\myTestfile{\jobname-test.tmp} \def\myTestbla{just a test} \starttext \immediate\write18{echo \myMacro{bla} \myMacro{blub} >\myTestfile} \typefile{\myTestfile} \stoptext Greetings, Peter -- http://pmrb.free.fr/contact/
� wrote:
Hello, with the following test-file I expect the output: "Yes No" But the output is: "edef @@lycurrentstate{myTestbla}No edef @@lycurrentstate{myTestblub}No" Where does this come from, and how could I get it right please?
\def\myMacro#1{\doifdefinedelse{myTest#1}{Yes}{No}} \def\myTestfile{\jobname-test.tmp} \def\myTestbla{just a test} \starttext \immediate\write18{echo \myMacro{bla} \myMacro{blub} >\myTestfile} \typefile{\myTestfile} \stoptext
Greetings, Peter
\def\myMacro#1{\ifundefined{myTest#1}Yes\else No\fi} (see definition of \doifdefinedelse: it does some clever things in order to handle messy #1's) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Fri, 14 Apr 2006, Hans Hagen wrote:
\def\myMacro#1{\doifdefinedelse{myTest#1}{Yes}{No}} \def\myTestfile{\jobname-test.tmp} \def\myTestbla{just a test} \starttext \immediate\write18{echo \myMacro{bla} \myMacro{blub} >\myTestfile} \typefile{\myTestfile} \stoptext
\def\myMacro#1{\ifundefined{myTest#1}Yes\else No\fi}
(see definition of \doifdefinedelse: it does some clever things in order to handle messy #1's)
Great, thanks for your fast help! I tried a lot of things with \expanded{} and \unexpanded but I've never thought of looking for another if-else command... Thanks, Peter -- http://pmrb.free.fr/contact/
participants (2)
-
Hans Hagen
-
Peter Münster