title: sed not properly passing stdout to ls
body: <p>I'm trying to edit a simple string in sed that I've been having issues with. 
  Basically what I'm trying to do is grab my current working directory using pwd, pipe it to sed, edit the file path, then check the file paths contents using ls. The reason I need to do this is to dynamically check backups to see if backups contain the files I need in the folder that I'm currently working in (just going to make it into a quick hotkey).</p>
  
  <p>Here's what I've got so far:</p>
  
  <pre><code>    pwd | sed "s/`whoami`/`whoami`.{daily,weekly,monthly}/g" | xargs ls
  </code></pre>
  
  <p>When running this on my server (it's a shared hosting server, hence the need for <code>whoami</code> instead of just username) I get this error:</p>
  
  <pre><code>    /bin/ls: cannot access /home1/username.{daily,weekly,monthly}: No such file or directory
  </code></pre>
  
  <p>However, I'm able to run this command without any issues:</p>
  
  <pre><code>    ls /home1/username.{daily,weekly,monthly}
  </code></pre>
  
  <p>I've tried probably ~20 different variations of this command (various sed and xargs flags as well) and can't seem to get it to work properly. I believe this error is being caused by how sed handles the search and replace with streams, however I don't know how to get around it or what <em>exactly</em> it is that's causing it.</p>
  
  <p>I believe it's sed that's causing the issue as this command has the same error:</p>
  
  <pre><code>    ls `pwd | sed "s/$(whoami)/$(whoami).{daily,weekly,monthly}/g"`
      /bin/ls: cannot access /home1/username.{daily,weekly,monthly}: No such file or directory
  </code></pre>
  
  <p>If anyone can tell me why it's happening, or some way for sed to properly pass the edited version to ls. I should be able to figure out a command for it, I just need to know why. Thanks!</p>