title: Copy files from a WWW folder to External Server through SCP
body: <p>I want to copy some local file allocated in a local web-server (under <code>apache-2</code>) to a external server folder.
  I already copied the public key in the external server and my password is not required when I access via <code>Linux Terminal</code>, but when I try to do the same using a <code>Bash</code> script, the command doesn't work, and nothing happens.
  Here my <code>sh</code> code:</p>
  
  <pre><code>#!/bin/bash
  
  text=("$1");
  times_text=("$2");
  gender=("$3");
  pitch=("$4");
  mood=("$5");
  
  paste &lt;(printf "%s\n" "${times_text[@]}") &lt;(printf "%s\n" "${text[@]}") &lt;(printf "%s\n" "${gender[@]}") &lt;(printf "%s\n" "${pitch[@]}") &lt;(printf "%s\n" "${mood[@]}") &gt; ./tmp/data.txt
  
  cat ./tmp/data.txt  | cut -f 2-2 | while read line; 
  do 
      echo $line &gt;&gt; ./tmp/file_to_copy.txt;
  done
  
  scp ./tmp/file_to_copy.txt user@externalServer:Folder/to/copy
  </code></pre>
  
  <p>I need to do these commands remotely and I don't know why the file is not copied in the desired external server folder.</p>