Error executing shell script in Linux


 
Thread Tools Search this Thread
Operating Systems Linux Error executing shell script in Linux
# 1  
Old 05-13-2009
Question 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.
# 2  
Old 05-14-2009
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error while executing the shell script

Hi Gurus, The following script fails with the error 'command not found' while trying to execute. As the error indicates, the script fails at ROW#30 where the EOF is defined for SQL statement. It appears that the script is trying execute the lines in the SQL output written to ta spool file.... (7 Replies)
Discussion started by: svajhala
7 Replies

2. Shell Programming and Scripting

Executing perl script in Linux gives :Exec format error. Wrong Architecture

i have perl script that used to be working great , once i edit it in windows and convert it to UTF-8 and then via FTP return it . also did: chmod +x foo.pl and then when i try to run it : ./foo.pl im getting this error: ./foo.pl: Exec format error. Wrong Architecture.... (4 Replies)
Discussion started by: umen
4 Replies

3. UNIX for Advanced & Expert Users

Linux : getting error while executing mkfs

Hi All, i am getting below error while executing mkfs after creating a new partition in linux /dev/sda2 is apparently in use by the system ; will not make a filesystem here. Anyone having any idea , how to solve this problem thanks (2 Replies)
Discussion started by: Jcpratap
2 Replies

4. Shell Programming and Scripting

SP2-0642 error while executing procedure from shell script

hi all, i have a unix script where i am calling a database procedure from it. while executing the procedure i am getting an error: but when i tried to call the same procedure manually then it ran successfully, i goggled this issue and found timezone.dat file missing at... (0 Replies)
Discussion started by: lovelysethii
0 Replies

5. Shell Programming and Scripting

error when executing shell scrpit

Guys, when i am executing the following script I am getting following error. -bash: test.sh: command not found $ test.sh -- script name #! /bin/bash echo " Job started........" CURRENTDIR=`pwd` exit 0 thanks Please view this link: How to use ... tags (2 Replies)
Discussion started by: skatpally
2 Replies

6. Shell Programming and Scripting

Linux- shell script - if then else - error

Hi I am using Linux, I am getting the error while executing the shell script., the code in the shell script is # $Header:$ #!/bin/ksh l_filesleft=1 if then echo "File has exceeded the 100 MB limit." else echo "None" fi Error: mc.sh: line 9: syntax error: unexpected end of file ... (11 Replies)
Discussion started by: dc_dc
11 Replies

7. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

8. Shell Programming and Scripting

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... (2 Replies)
Discussion started by: Chaitrali
2 Replies

9. Shell Programming and Scripting

Error executing shell command from a perl script

Hi Gurus, I've a find command that gets the list of files from a source directory where the extension is not html, xml, jsp, shtml or htaccess. The below find command runs fine from the command prompt or in a shell script. I need to eventually run it in a PERL script and am getting the... (5 Replies)
Discussion started by: voorkey
5 Replies

10. Shell Programming and Scripting

Error message while executing the shell script

Hi All, When I am trying to execute the below shell script I got this error message. script ========== #!/bin/bash /usr/java/jdk1.5.0_10/bin/java - classpath /var/lib/asterisk/agi-bin/mysql-connector-java-3.0.15-ga-bin.jar/: /var/lib/asterisk/agi-bin/jarfiles:... (4 Replies)
Discussion started by: ajayyaduwanshi
4 Replies
Login or Register to Ask a Question