UNIX shell script error: not found


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX shell script error: not found
# 1  
Old 11-05-2015
UNIX shell script error: not found

Hello All,

I'm working on one Unix shell sript that will actually extract a column data from Oracle table using sqlplus and writes onto a file. I'm getting this error when executing the shell script:

rpt.ksh[156]: ^JScott: not found

Below is the code in the shell script:

Code:
 `sqlplus -s ${TEST DB} <<EOF
    WHENEVER OSERROR EXIT 9
    WHENEVER SQLERROR EXIT SQL.SQLCODE
set trim on
set tab off
set linesize 8000
Select emp_name FRom EMP_A S where empno=1;
EOF` >> /dev/xyz.txt

The query in the Shell script would retrieve one value i.e Scott

I have executed the query in SQLPLUS editor and I could see o/p being displayed.

Looks like an issue in writing the column value(special character getting appended i.e ^J) onto the text file by the shell script.


Please suggest.

Thanks in Advance.

Regards,
Venkat
Can you please suggest?

Fun Fact:


Quote:
An essential feature of programming is the ability to use a name or a label to refer to some other quantity: such as a value, or a command. This is commonly referred to as variables.

Variables can be used, at the very least, to make code more readable for humans:
# 2  
Old 11-05-2015
Being the first word in the line, the shell will try to execute the result of the command substitution.


Fun UNIX Fact

Quote:
Command substitution allows the output of a command to replace the command itself. Command substitution occurs when a command is enclosed as follows:

$(command)
or

`command`
Bash performs the expansion by executing command in a subshell environment and replacing the command substitution with the standard output of the command, with any trailing newlines deleted. Embedded newlines are not deleted, but they may be removed during word splitting. The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).

When the old-style backquote form of substitution is used, backslash retains its literal meaning except when followed by ‘$', ‘`', or ‘\'. The first backquote not preceded by a backslash terminates the command substitution. When using the $(command) form, all characters between the parentheses make up the command; none are treated specially.

Command substitutions may be nested. To nest when using the backquoted form, escape the inner backquotes with backslashes.

If the substitution appears within double quotes, word splitting and filename expansion are not performed on the results.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

+: not found Error in shell script

Hi , I am a newbie to shell scripting. I am getting the error on AIX machine /tadfdc_setup_fed.sh: +: not found Here tadfdc_setup_fed.sh is script which works fine on Linux Machine. But gives error on AIX (1 Reply)
Discussion started by: Anupam Kakade
1 Replies

2. Shell Programming and Scripting

UNIX--Check Process not found error

hi guys can you please help me i have the following script to load to a database but when i execute it...its saying Check_Process: not found #!/bin/ksh ##-To load Oracle user profile ##./monitor_io.ksh ##./test.ksh SCP_DIR=/export/home/yani_m/scripts ... (9 Replies)
Discussion started by: LucyYani
9 Replies

3. Shell Programming and Scripting

Syntax Error in Unix Shell Script

I am trying to run a unix script in my home directory.Snippet below echo "`date '+%Y%m%d_%H%M%S'` Getting ProductList.dat" if ( -f $DIR/ProductList.dat) then cp $DIR/ProductList.dat MigratedProductList.dat else echo "`date '+%Y%m%d_%H%M%S'`ProductList.dat does not exist; Processing... (4 Replies)
Discussion started by: Mary James
4 Replies

4. UNIX for Dummies Questions & Answers

Mailx command in unix shell script, its throwing below error

How to use Mailx command in unix shell script, its throwing below error #!/bin/ksh let x=3 If ; then mailx -s “ $x is greater than 2” example@gmail.com << EOF This is the message body EOF fi its throwing error as syntax error at EOF... (10 Replies)
Discussion started by: only4satish
10 Replies

5. Shell Programming and Scripting

#!/bin/bash and #1bin/sh command not found error on mac osx terminal/shell script

i am having a weird error on mac os x running some shell scripts. i am a complete newbie at this and this question concerns 2 scripts. one of which a friend of mine wrote (videochecker.sh) a couple weeks ago and it's been running fine on another machine. then last week i wrote capture.sh and it... (2 Replies)
Discussion started by: danpaluska
2 Replies

6. Shell Programming and Scripting

found error 138 while run shell script

I found error 138 while run a shell script. Please tell me what it's mean?? and how can i prevent that error. Thanks in advance..... (1 Reply)
Discussion started by: rinku
1 Replies

7. Shell Programming and Scripting

Shell script run error ksh: not found

Hi All, I am trying to run a script to FTP files from one UNIX server to another UNIX server. Actually I can able to FTP file successfully by manually or paste whole script at prompt. But when I am trying to run script it is giving error. Please let me know the cause. #!/bin/sh... (3 Replies)
Discussion started by: nz80qy
3 Replies

8. Shell Programming and Scripting

Ambiguous and Command not found Error in UNIX

Hi,All I wrote below script(Example1.sh) and i ran but i got error. it's excuted yesterday. SYSTEM_TIME=`date '+%H:%M:%S'` CMP_LOG_TIME=`head -1 runcmp-HINET.log` CMP_ENDED1=`grep 'HINET CMP ended' runcmp-HINET.log` CMP_ENDED2=`echo "HINET CMP ended"` CMP_FAILED2=`echo "HINET CMP... (2 Replies)
Discussion started by: koti_rama
2 Replies

9. UNIX for Dummies Questions & Answers

Ambiguous and Command not found Error in UNIX

Hi,All I wrote below script(Example1.sh) and i ran but it giveing error. it's excuted yesterday. SYSTEM_TIME=`date '+%H:%M:%S'` CMP_LOG_TIME=`head -1 runcmp-HINET.log` CMP_ENDED1=`grep 'HINET CMP ended' runcmp-HINET.log` CMP_ENDED2=`echo "HINET CMP ended"` CMP_FAILED2=`echo "HINET... (2 Replies)
Discussion started by: koti_rama
2 Replies
Login or Register to Ask a Question