Chef - execute vs bash resource
<p>I used both the <code>execute</code> resource or the <code>bash</code> resource.</p>

<p>Both achieve the same result:</p>

<pre><code>bash 'Execute my script' do 
  user 'root'
  cwd  '/mydir'
  code &lt;&lt;-EOH
    ./myscript.sh
  EOH
end

execute 'Execute my script' do 
  user    'root'
  cwd     '/mydir'
  command './myscript.sh'
end
</code></pre>

<p>The only difference I see is that <code>bash</code> actually creates a shell script (named <code>/tmp/chef-script#{date}{#id}</code>) where <code>code</code> is written.</p>

<p>What is the best practice to execute a shell script with Chef between <code>execute</code> or <code>bash</code> resource ?</p>