List Info

Thread: Re: Executing shell command, save results to variable




Re: Executing shell command, save results to variable
country flaguser name
United States
2007-02-28 10:51:58
Diane,

Any chance of sharing your vision and some of your
enhancements with us? I would
love to see a back-tick capability for Jam.

Gary

Diane Holt wrote:
> I've done both. I pass back-ticked pkg-config commands
on my compile and
> link lines -- ie., I add them to the flags for each
(from a new rule,
> though, not an override on Cc/C++/Link -- although I do
have overrides
> for those rules, but for other reasons). And I also
modified Jam to be
> able to run a shell command from a rule (it bugged me
that there was
> something Make could do that Jam couldn't 
> 
> In your case, Chris, if all you need is to pass that
wx-config in on the
> command line, adding it to the flags is the easiest way
to go.
> 
> Diane
> 
> 
>
------------------------------------------------------------
------------
> 
> _______________________________________________
> jamming mailing list  -  jammingperforce.com
> http://maillist.perforce.com/mailman/listinfo/jamming


_______________________________________________
jamming mailing list  -  jammingperforce.com
http://maillist.perforce.com/mailman/listinfo/jamming

  
Re: Executing shell command, save results to variable
user name
2007-02-28 11:19:20
I didn't do it as a back-tick, but as a new built-in rule, which I call Command. It's used inside square brackets.

For example, this just captures the return code (note: the square brackets passed in the Command itself is the shell's 'test', not Jam's brackets):

RT_OK = [ Command "[ -e /lib/libc.so -o -e /usr/lib/libc.so ] ; echo $?" ] ;
if $(RT_OK) != 0 { Exit "Error: You must install the C runtime before building." ; }

(P.S. So you don't think I'm crazy, testing for something like that -- that's being run inside a chroot';d environment

This one captures the actual output:

local libname = [ Command "echo $(shared_lib) | sed -e 's:\(.*\)\.so\..*$:\1.so:9;" ] ;

If you're still interested, I can send the diff of builtins.c.

Diane

On 2/28/07, Gary Gendel < garyicmanage.com">garyicmanage.com> wrote:
Diane,

Any chance of sharing your vision and some of your enhancements with us? I would
love to see a back-tick capability for Jam.

Gary

Diane Holt wrote:
>; I've done both. I pass back-ticked pkg-config commands on my compile and
> link lines -- ie., I add them to the flags for each (from a new rule,
> though, not an override on Cc/C++/Link -- although I do have overrides
> for those rules, but for other reasons). And I also modified Jam to be
> able to run a shell command from a rule (it bugged me that there was
> something Make could do that Jam couldn';t
>
> In your case, Chris, if all you need is to pass that wx-config in on the
> command line, adding it to the flags is the easiest way to go.
>
&gt; Diane
>
>
> ------------------------------------------------------------------------
>;
> _______________________________________________
> jamming mailing list  -&nbsp;  jammingperforce.com">jammingperforce.com
> http://maillist.perforce.com/mailman/listinfo/jamming



[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )