title: Cadaver bash script upload
body: <p>Please note: I need to insert some spaces in URLs, because of the restrictions of StackOverflow.</p>
  
  <p>I have a FreeBSD server. I need to backup my previously tar.gz databases on a WebDav cloud storage as Yandex Disk or Box.com or 4Shared.</p>
  
  <p>Everything works fine with Putty, command line after command line. I am be able to upload my file on Yandex Disk:</p>
  
  
  
  <pre class="lang-none prettyprint-override"><code>%cadaver  
  dav:!&gt; open https://webdav.yandex.com  
  Authentication required for Yandex.Disk on server `webdav.yandex.com':
  Username: MyUserName
  Password:
  dav:/&gt; put MyFile.tar.gz
  Uploading MyFile.tar.gz to `/MyFile.tar.gz':  
  Progress: [=============================&gt;] 100.0% of 1229518 bytes succeeded.
  dav:/&gt; exit  
  Connection to ` webdav . yandex . com' closed.  
  %
  </code></pre>
  
  <p>However, my bash script fails to upload my file.</p>
  
  <p>Here is my bash script "criptdav.sh":</p>
  
  <pre class="lang-sh prettyprint-override"><code>#!/bin/sh
  
  /usr/local/bin/cadaver &lt; datadav
  </code></pre>
  
  <p>Here is my "datadav" file:</p>
  
  <pre class="lang-none prettyprint-override"><code>open https:// webdav . yandex . com  
  MyUserName  
  MyPassword  
  put MyFile.tar.gz  
  exit
  </code></pre>
  
  <p>Here is Putty screenshot of my bash script:</p>
  
  <pre class="lang-none prettyprint-override"><code>%sh scriptdav.sh  
  dav:!&gt; open https://webdav.yandex.com  
  Authentication required for Yandex.Disk on server `webdav.yandex.com': 
  Username: MyUserName
  dav:/&gt; 
  Connection to `webdav.yandex.com' closed.  
  %
  </code></pre>
  
  <p>Nota Bene:</p>
  
  <p>I tried with Yandex, Box, 4Shared. Same result. Script fails to upload my file.</p>
  
  <p><strong>QUESTION:</strong></p>
  
  <p><strong>What's wrong with my bash script?</strong></p>