Issue with shell Script file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Issue with shell Script file
# 1  
Old 05-17-2007
Issue with shell Script file

Hi,

I created the following shell script file :

bash-3.00$ more Unlock_Statistics1.sh
#!/usr/bin/ksh

ORACLE_SID=prsal02; export ORACLE_SID
NLS_LANG=AMERICAN_AMERICA.AL32UTF8; export NLS_LANG

sqlplus -s /nolog << EOF
connect / as sysdba ;
set serveroutput on size 1000000;
execute dbms_stats.unlock_schema_stats('IDOADMIN') ;
exit;
EOF

When I tried to run it .. it gives error as under:

bash-3.00$ sh Unlock_Statistics1.sh
: command not foundsh: line 2:
': not a valid identifierne 3: export: `ORACLE_SID
': not a valid identifierne 4: export: `NLS_LANG
: command not foundsh: line 5:

Now, The above script is working fine on one of the Development server but its not working on production server as shown above.. moreover the command file generates this:

bash-3.00$ file *
Export.sh: a /usr/bin/ksh script text executable
Grants.sh: a /usr/bin/ksh script text executable
idoadmin_import.log: empty
idodbp01.dmp: DBase 3 data file (1380929624 records)
idouser1_import.log: empty
Import.sh: a /usr/bin/ksh script text executable
Increase_Column_Widths1.sh: a /usr/bin/ksh\015i script text executable
Migration.sh: a /usr/bin/ksh script text executable
Pre_Import_Destination_DB.sh: a /usr/bin/ksh script text executable
Unlock_Statistics1.sh: a /usr/bin/ksh\015i script text executable

I can see that files "Unlock_Statistics1.sh" and "Increase_Column_Widths1.sh" are showing diff result and they are the files that are throwing errors... rest of all shell files are working fine...

I have created them manually and not copied.....

Pls kindly help me in resolving the error...and cause of it..

Kindly note that i am new to unix but i do now basics of it..

Thanks
# 2  
Old 05-17-2007
You have somehow added a CR character to each line. Fix by using dos2unix.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script issue

Below is my script. However when i run it, i get the below error ./dummy.sh: line 27: syntax error: unexpected end of file #!/bin/bash while : do read -r INPUT_STRING case $INPUT_STRING in test) echo "Please enter id no : " read... (4 Replies)
Discussion started by: chandraprakash
4 Replies

2. Shell Programming and Scripting

Issue in shell script

item,quantity,unit price,total tea,1,1,1 coffee,3,4,12 sugar,5,2.5,12.5 tea,2,1,3 coffee,2,4,8 i have got the above file with following questions: need to get the total value: which i got using : a=0 for b in `cut -f4 -d ',' log` do c=`echo $a + $b | bc` a=$c done echo "$a and $c" ... (9 Replies)
Discussion started by: bhupeshchavan
9 Replies

3. Shell Programming and Scripting

Issue with shell script

I found a post from a user requesting help rounding numbers. The script provided by Scrutinizer works fine most of the time but it errors out when trying to round these numbers: 30224939 50872456 20753012 They have in common, a zero in the second digit from left to right. Can someone help... (1 Reply)
Discussion started by: Dennis_Ayala
1 Replies

4. Shell Programming and Scripting

Issue in TC Shell Script

I have a script in TC shell, for some reason its not working. I'm trying to kick off a script if there are any files in a particular directory "/sample/test3" Can anyone point out the issue in the same #!/usr/bin/tcsh while true do if ls /sample/test3 >& /dev/null ; then... (2 Replies)
Discussion started by: gaugeta
2 Replies

5. UNIX for Dummies Questions & Answers

Shell script emailing issue

Hi, Im writing a shell script: #!/bin/bash #Send process which has exceeded 25% # echo 'pri pid user nice pcpu command' > /export/home/tjmoore/file2 # if ps -eo pri,pid,user,nice,pcpu,comm | awk '{if($5 >= 25)print $0}' >> /export/home/tjmoore/file2 2>/dev/null # # # then... (1 Reply)
Discussion started by: jay02
1 Replies

6. Shell Programming and Scripting

Help me with following issue using shell script

Hi Folks, I am looking for a script where that should show the progress bar while running a process Ex: while copying a file of size say 2 GB it should start the process as (0 %) and at the end it should show (100%) Thanks in Advance Phani. (4 Replies)
Discussion started by: phanivarma
4 Replies

7. Shell Programming and Scripting

issue invoking shell script using cron, even with proper file permission

I am using tcsh what could possibly be a problem, when using crontab to invoke a shell script. ? The script has the read, write and execute permission to all users. And the script works as expected while executing it in stand-alone mode. Is there a way to trace (like log) what error... (9 Replies)
Discussion started by: vikram3.r
9 Replies

8. UNIX for Dummies Questions & Answers

Issue with shell script: not detecting file properly

The following script is meant to check the presence of a file - called filename0.94.tar.gz - and uncompress it: #!/bin/sh # check presence of file VERSION=0.94 if ; then # file not present: abort echo "Files cannot be found." #exit 1 (commented out this line, so we can see how the... (2 Replies)
Discussion started by: figaro
2 Replies

9. Shell Programming and Scripting

Issue with the shell script

hi , this script was devloped by somebody whome I dont know way back # cat run_ucid.sh #!/bin/csh # run_ucid.sh # # This is a simple shell script that will start an application in # the background and restart the application if it stops. Upon # termination an email message is sent and the... (2 Replies)
Discussion started by: viv1
2 Replies

10. Shell Programming and Scripting

Issue with a shell script

Hi All, I have an issue in writing the shell script to install a webserver on UNIX system. My shell script look something like this. ------------------------------------------------------------ echo "start of the script" #! /bin/sh cd /home/path echo | setup.hp -is:javaconsole -console... (4 Replies)
Discussion started by: vishalm
4 Replies
Login or Register to Ask a Question