[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
passing positional arguments to esyscmd
From: |
Sergey Astanin |
Subject: |
passing positional arguments to esyscmd |
Date: |
Wed, 5 Oct 2005 17:48:51 +0200 (CEST) |
User-agent: |
SquirrelMail/1.4.3a |
Hello, everybody,
I cannot figure out how to pass positional arguments of a macro to
esyscmd. I tried googling but found no examples beyond simple calls like
esyscmd(`date'). In my case the shell command depends on positional
arguments: I want to write macro like _MY_MACRO(var1,var2) that expands to
``var1 : some-text-generated-using-var2'', where
``some-text-generated-using-var2'' is an output of my perl script
``./script.pl var2''.
The first thing I tried was:
m4_define(`_MY_MACRO', `$1 : 'm4_esyscmd(`./script.pl '$2))
It does not work, and the scipt diagnostics shows that it was called
without any argument. I also tried m4_esyscmd(`./script.pl $2'),
m4_esyscmd(./script.pl $2), but none of them worked.
Though, if I write something like
m4_define(`_MY_MACRO', `$1 : '(`./script.pl '$2))
the shell command is displayed correctly: ``./script.pl var2''.
So, I suppose, esyscmd expands its arguments in a different way, than that
of a normal macros, or probably, the positional parameters are treated
differently. The question is how I may call esyscmd and have all its
arguments expanded.
I would appreciate any clue or advise, or a workaround.
Sincerely yours,
Sergey Astanin.
- passing positional arguments to esyscmd,
Sergey Astanin <=