<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: unix code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Wed, 20 Aug 2008 05:53:55 GMT</pubDate>
    <description>DZone Snippets: unix code</description>
    <item>
      <title>Just #@$% do it!</title>
      <link>http://snippets.dzone.com/posts/show/3076</link>
      <description>If you have an unreliable network feed and want to run something like rsync, scp, etc. without having to babysit it a simple function can be used to prefix a command.  The function looks like this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# Function to force a command to try until it works.&lt;br /&gt;# Name means "JUST #@$% DO IT!"&lt;br /&gt;JFDI () {&lt;br /&gt;  COMMAND=$*&lt;br /&gt;  while ! $COMMAND ; do echo "Retrying..." ; done&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Using it is simplicity itself:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# command that can fail and annoy&lt;br /&gt;rsync -avz /my/local/directory/ myuser@host:~/my/remote/directory/&lt;br /&gt;&lt;br /&gt;# command that won't give up ever&lt;br /&gt;JFDI rsync -avz /my/local/directory/ myuser@host:~/my/remote/directory/&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 04 Dec 2006 17:32:15 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3076</guid>
      <author>ttmrichter (Michael T. Richter)</author>
    </item>
  </channel>
</rss>
