title: Linux bash script doesn't run correctly, but when run at the command line everything is fine
body: <p>Originally I thought this was a db administration issue, but I think the lines have become a little blurred. I'm going to keep this strictly a scripting problem here. If you want more background info I posted this on ServerFault here:</p>
  
  <p><a href="https://serverfault.com/questions/511780/postgresql-pgdump-script-on-rhel5-failed-fe-sendauth-no-password-supplieddat">https://serverfault.com/questions/511780/postgresql-pgdump-script-on-rhel5-failed-fe-sendauth-no-password-supplieddat</a></p>
  
  <p><b>My Script</b></p>
  
  <p>I distilled my original script down to this to keep things simple. This is what I have in a .sh named <em>pg_dump_script</em>:</p>
  
  <pre><code>/home/myusername/lappstack-1.2-5/postgresql/bin/pg_dump --host=127.0.0.1 --port=5433 --username=myusername mydbname
  </code></pre>
  
  <p><b>When I run this I get the following error:</b></p>
  
  <pre><code>$ bash pg_dump_script.sh
  Password:
  " does not exist  database "corenection to database "mydbname
  </code></pre>
  
  <p>I can copy and paste the line in the script file and run it from the command line and everything works fine.</p>
  
  <p><b>Here are the permission on the script file:</b></p>
  
  <pre><code>-rwxr-xr-x
  
  I used chmod 755
  </code></pre>
  
  <p>I'm not sure what I'm doing wrong here? I'm not an expert on scripting, but I thought if I could run it from the console it would of course run fine from a script. Let me know if any information is needed. I'm trying to keep this simple.</p>
  
  <p><b>Updates</b></p>
  
  <p>I removed all parameters. This is all the text in the .sh</p>
  
  <pre><code>/home/myusername/lappstack-1.2-5/postgresql/bin/pg_dump
  </code></pre>
  
  <p>I receive this error:</p>
  
  <pre><code>    $ ./pg_dump_script.sh
  : No such file or directoryine 1: /home/myusername/lappstack-1.2-5/postgresql/bin/pg_dump
  : command not foundst.sh: line 2:
  </code></pre>