title: How to call this shell script to convert mysqldump to SQLite compatible syntax
body: <p>I need to autonomously convert mysqldump files (.sql file) to SQLite compatible .sql files. I found this <a href="https://gist.github.com/esperlu/943776" rel="nofollow noreferrer">script</a> on github which is supposed to be able to do this. If I had an unmodified .sql file from MySQL called test.sql whose database's name was test and the script mysql2sqlite.sh in a directory, how would I call it. </p>
  
  <p>The script says in the comments how to call it. I believe my scenario matches the first one titled usage because I already have the mysqldump file.</p>
  
  <pre><code># Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
  # Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
  </code></pre>
  
  <p>I read in the comments on the github page to change the scripts permissions with <code>chmod +x mysql2sqlite.sh</code> so navigated to the directory with the sql and the script and did that.
  Then I tried: </p>
  
  <p><code>pi@raspberrypi ~ $ ./mysql2sqlite.sh test.sql test | sqlite3 database.sqlite</code> </p>
  
  <p>It failed with the error: <code>-bash: ./mysql2sqlite.sh: /bin/sh^M: bad interpreter: No such file or directory</code></p>
  
  <p>I then read online that to call an .sh file you type <code>sh myShellFile.sh</code></p>
  
  <p>So I tried <code>sh mysql2sqlite.sh test.sql test | sqlite3 database.sqlite</code>
  and got back:</p>
  
  <pre><code>: not founde.sh: 2: mysql2sqlite.sh:
  : not founde.sh: 5: mysql2sqlite.sh:
  : not founde.sh: 8: mysql2sqlite.sh:
  : not founde.sh: 11: mysql2sqlite.sh:
  : not founde.sh: 13: mysql2sqlite.sh:
  : not founde.sh: 14: mysql2sqlite.sh:
  mysqldump: Got error: 1045: Access denied for user 'pi'@'localhost' (using password: NO) when trying to connect
  : not founde.sh: 15: mysql2sqlite.sh:
  </code></pre>
  
  <p>It appears that its trying to connect to a server rather than reading the mysqldump file that I provided. What is the proper way to call this script. I have some experience with Linux and no experience with unix shells. </p>
  
  <p>It may be of some use to read the background of my <a href="https://stackoverflow.com/questions/28747242/what-type-of-backend-to-use-for-ios-app">problem</a></p>
  
  <p>EDIT: After editing the first line of the script running it again produces the error <code>Error: near line 4: near "Insert": syntax error</code></p>
  
  <p>Here is the sqldump I'm trying to process:</p>
  
  <pre><code>-- phpMyAdmin SQL Dump
  -- version 4.1.14
  -- http://www.phpmyadmin.net
  --
  -- Host: 127.0.0.1
  -- Generation Time: Feb 28, 2015 at 06:00 AM
  -- Server version: 5.6.17
  -- PHP Version: 5.5.12
  
  SET time_zone = "+00:00";
  
  
  /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  /*!40101 SET NAMES utf8 */;
  
  --
  -- Database: `test`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `testtable`
  --
  
  CREATE TABLE IF NOT EXISTS `testtable` (
    `FirstName` varchar(30) NOT NULL,
    `LastName` varchar(30) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `testtable`
  --
  
  INSERT INTO `testtable` (`FirstName`, `LastName`) VALUES
  ('', ''),
  ('Josh', 'Kallus'),
  ('', ''),
  ('Josh', 'Kallus');
  
  /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  </code></pre>