title: Using shell script to insert data into remote MYSQL database
body: <p>I've been trying to get a shell(bash) script to insert a row into a REMOTE database, but I've been having some trouble :(</p>
  <p>The script is meant to upload a file to a server, get a URL, HASH, and a file size, connect to a remote mysql database, and insert the data into an existing table. I've gotten it working until the remote MYSQL database bit.</p>
  <p>It looks like this:</p>
  <pre><code>#!/bin/bash
  
  zxw=randomtext
  description=randomtext2
  
  for file in &quot;$@&quot;
   do
   echo -n *****
   ident= *****
   data= ****
   size=` ****
   hash=`****
  mysql --host=randomhost --user=randomuser --password=randompass randomdb
  insert into table (field1,field2,field3) values('http://www.example.com/$hash','$file','$size');
  echo &quot;done&quot;
  done
  </code></pre>
  <p>I'm a total noob at programming so yeah :P</p>
  <p>Anyway, I added the \ to escape the brackets as I was getting errors. As it is right now, the script is works fine until connects to the mysql database. It just connects to the mysql database and doesn't do the insert command (and I don't even know if the insert command would work in bash).</p>
  <p>PS: I've tried both the mysql commands from the command line one by one, and they worked, though I defined the hash/file/size and didn't have the escaping &quot;&quot;.</p>
  <p>Anyway, what do you guys think? Is what I'm trying to do even possible? If so how?</p>
  <p>Any help would be appreciated :)</p>