title: how to pass parameter to execute in chef?
body: <p>I'm new to chef. Recently, I'm studying the resources, I got a problem on how to pass parameter to command in execute in chef. Here's the details --
  I searched this page -- <a href="https://discourse.chef.io/t/pass-parameter-to-bash-script-and-call-bash-scripts-in-chef-cookbook/10431" rel="nofollow noreferrer">https://discourse.chef.io/t/pass-parameter-to-bash-script-and-call-bash-scripts-in-chef-cookbook/10431</a>  -- it looks using ruby variable format #{xxx} can pass a variable in recipe to the script in &quot;execute&quot; in recipe
  I made a test, first my recipe --</p>
  <pre><code>execf=&quot;haha&quot;
  
  file '/tmp/e.sh' do
      content '
  #!/bin/bash
  cat /tmp/e.log
  DT=`date +%F&quot; &quot;%T`
  echo $1&quot; &quot;${DT} &gt;&gt; /tmp/e.log
  '
      mode '755'
      execf=&quot;e1&quot;
      notifies :run, 'execute[e.sh]', :delayed
  end
  
  file '/tmp/e2.sh' do
      content '
  #!/bin/bash
  cat /tmp/e.log
  DT=`date +%F&quot; &quot;%T`
  echo $1&quot; &quot;${DT} &gt;&gt; /tmp/e.log
  '
      mode '777'
      execf=&quot;e2&quot;
      notifies :run, 'execute[e.sh]', :delayed
  end
  
  execute 'e.sh' do
      command '/tmp/e.sh #{execf}'
      action :nothing
  end
  </code></pre>
  <p>I think -- this can record resouce &quot;e.sh&quot; or &quot;e2.sh&quot;'s runtime to e.log. And there's no syntax error when run &quot;chef-client&quot;. But to my suprise -- the #{execf} -- is always a &quot;&quot; string while calling /tmp/e.sh... So in e.log, I can only see --</p>
  <pre><code> 2022-05-13 22:04:48
   2022-05-13 22:17:44
   2022-05-13 22:19:07
  </code></pre>
  <p>Only a &quot;&quot; was passing to the /tmp/e.sh as $1... At first I think maybe it's due to the execf is a local variable in ruby so I tried @execf and $execf ... but all didn't work. Maybe in recipe, I shouldn't use variable, but should use node attribute? But I can't find how to modify node attribute in resource...
  Please kind help. Thanks in advance for any idea.</p>