So as a variable I get passed in $home and it may be for example > /first/second/userdirectory where first and second may not exist. > > So I wanted to do a simple exec command which does the following if I were > to do it at the command line: > > mkdir -p ${home%/*} > > ...this would make /first/second and I can allow useradd create the > userdirectory. > > BUT....puppet doesn't like me passing that to command. > > exec { "$home.create": > path => '/bin:/usr/bin', > command => "mkdir -p '${home%/*}'", > } > > I get Could not match %/*}\" > > > So firstly in the context of
command => "mkdir -p '${home%/*}'", Puppet will try and look up variable: home%/* Because it is ${ and double quoted, so puppet is trying to compile the command as it is ${ in a double quoted string which puppet understands as a variable. I do not understand the context of the % percent and * wildcard references. But is $home was defined as '/first/second', then: command => "mkdir -p ${home}", As for passing special characters, different blends of variables and special characters should always be tested. Special characters should be passed via the exec command context if single quoted and no variables, not 100% certain, it always pays to test. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/4QCHahZc-MYJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.