help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange behaviour with iteration with shellcommands


From: Tim Nelson
Subject: Re: Strange behaviour with iteration with shellcommands
Date: Tue, 1 Jun 2004 11:06:46 +1000 (EST)

On Mon, 31 May 2004, DRANSUTAVICIUS, CLAUDIO wrote:

>
> Hello
>
> I was wondering if someone could explain why I am getting this behavior
> when I run a shell command with
> some iteration. Here is the code:
>
> control:
>
>    testcmd = ( "/bin/echo" )
>
>    name = ( ":one:two:three" )
>    actionsequence = ( shellcommands  )
>
> shellcommands:
>
>       "${testcmd} ${name} ${name}"
>
>
> I would expect to see the following:
>
> cfengine:al2ccg:/bin/echo one : one one
> cfengine:al2ccg:/bin/echo two : two two
> cfengine:al2ccg:/bin/echo three: three three
>
> Instead the following is my output:
>
> cfengine:al2ccg:/bin/echo one o: one one
> cfengine:al2ccg:/bin/echo one t: one two
> cfengine:al2ccg:/bin/echo one t: one three
> cfengine:al2ccg:/bin/echo two o: two one
> cfengine:al2ccg:/bin/echo two t: two two
> cfengine:al2ccg:/bin/echo two t: two three
> cfengine:al2ccg:/bin/echo three: three one
> cfengine:al2ccg:/bin/echo three: three two
> cfengine:al2ccg:/bin/echo three: three three
>
> Any clues why this is happening?

        Here's a clue -- it does (or effectively does) the variable
substitution first, and the iteration figuring-out after.  You have two
sets of iterators, one from each ${name}

        Is that clue enough?

        :)


--
Tim Nelson
Systems Administrator
Sunet Internet
Tel: +61 3 5241 1155
Fax: +61 3 5241 6187
Web: http://www.sunet.com.au/
Email: sysadmin@sunet.com.au







reply via email to

[Prev in Thread] Current Thread [Next in Thread]