Error executing shell script in Linux

Hi,

I have following shell script code :
------------------------------------------------------------------
#!/bin/bash

SCRIPTS_DIR="/scriptsDir1"
# tables login/password
APIL_USER="uname/pswd"
I2_USER="uname/pswd"
# Database
DB="db1"

cd "$SCRIPTS_DIR/scriptsDir2"

sqlplus "$APIL_USER@$DB" @update.sql > $SCRIPTS_DIR/scriptsDir2/logs/update.log

exit
------------------------------------------------------------------
I get following errors:

  • : command not found : At every blank line
  • : No such file or directorysh: line 12: cd: /abpp/informaticadata/scripts

Also to execute the shell need to prefix the file name with "sh".

These commands work correctly if executed on command prompt.

But if I execute the same script on another Linux server it does NOT throw error. Also no prefixing of "sh" for execution is required.

Can anyone tell what settings to be checked???
I have checked user level settings, they are same!!!

Thanks in advance.

Regards,
Chaitrali.

Putting a "sh" in front of the script name starts the Bourne shell. If you can run it without the "sh" on another machine the default shell there is probably the Bourne shell.
You should definitely find out the types of shells.