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: DRANSUTAVICIUS, CLAUDIO
Subject: Re: Strange behaviour with iteration with shellcommands
Date: Tue, 01 Jun 2004 08:04:53 -0400

Hello

So I guess then you will never be able to copy from a master user directory
to the main user directory using
iteration. For example

control:

   testcmd = ( "/bin/cp" )
   homedir = ( "/home/Accounts" )
   masterdir = ( "/var/cfengine/master-files/home/Accounts" )
   name = ( "user1:user2" )

   actionsequence = ( shellcommands  )

shellcommands:

      "$(testcmd)   $(masterdir)/$(name)/master-value
$(homedir)/$(name)/value"

Is there any other way to do this.

Thanks


Tim Nelson wrote:

> 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]