title: Run shell commands from python and string concatenation
body: <p>I am trying to adjust the "post to dropbox" services for Snow loepard (<a href="http://dl.dropbox.com/u/1144075/Post%20to%20Dropbox.zip" rel="nofollow noreferrer">http://dl.dropbox.com/u/1144075/Post%20to%20Dropbox.zip</a>).
  I dont want the public URL, but a shortened one from goo.gl</p>
  
  <p>Therefor I am using these shell commands:</p>
  
  <pre><code>curl -s --data-urlencode "url=http://link.com" http://googl/action/shorten | grep "googl" | awk -F\" '{print $(NF-1)}' | awk 'BEGIN { FS = "=" } ; { print $2}' | pbcopy
  </code></pre>
  
  <p>Now the python script does this to copy a dropbox URL for all the files it just copies in the public folder to the clipboard:</p>
  
  <pre><code>    pasteURLs = []
  
  for file in copied_files: # for all elements in our list
      components = file.split(os.sep)    # seperate the path
      local_dir = os.sep.join(components[5:])    # cut off the beginning
      local_dir = urllib.quote(local_dir) # convert it to a URL (' ' -&gt; '%20', etc.)
      #construct the URL
      finalURL = 'http://dl.dropbox.com/u/%s/%s' % ( dropbox_id, local_dir )
      pasteURLs.append(finalURL) # add the current URL to the string
  
  copy_string = "\n".join(pasteURLs)
  os.system( "echo '%s' | pbcopy" % (copy_string) ) # put the string into clipboard
  </code></pre>
  
  <p>I have to admit I dont know anything about python, but from what it looks like, I need to change the last two lines with this:</p>
  
  <pre><code>shortURL = []
  for thisURL in pasteURLs:
          shortURL = os.system( curl -s --data-urlencode "url=http://link.com" http://googl/action/shorten | grep "goo.gl" | awk -F\" '{print $(NF-1)}' | awk 'BEGIN { FS = "=" } ; { print $2}' | pbcopy )
      shortURLs.append(shortURL)
  
  copy_string = "\n".join(shortURLs)
  os.system( "echo '%s' | pbcopy" % (copy_string) ) # put the string into clipboard
  </code></pre>
  
  <p>But my problem is, how to put the correct URL in the command? As u can see it says <code>http://link.com</code> But it should use <code>thisURL</code> instead.</p>
  
  <p>Any ideas? Thanks in advance!</p>