title: Using the result of a command as an argument in bash?
body: <p>To create a playlist for all of the music in a folder, I am using the following command in bash:</p>
  
  <pre><code>ls &gt; list.txt
  </code></pre>
  
  <p>I would like to use the result of the <code>pwd</code> command for the name of the playlist.</p>
  
  <p>Something like:</p>
  
  <pre><code>ls &gt; ${pwd}.txt
  </code></pre>
  
  <p>That doesn't work though - can anyone tell me what syntax I need to use to do something like this?</p>
  
  <p><strong>Edit:</strong> As mentioned in the comments pwd will end up giving an absolute path, so my playlist will end up being named .txt in some directory - d'oh! So I'll have to trim the path. Thanks for spotting that - I would probably have spent ages wondering where my files went!</p>