Sponsored Content
Top Forums Shell Programming and Scripting Receiving error: ./ang.ksh[35]: 0403-057 Syntax error at line 116 : `done' is not expected. Post 302424303 by Scott on Tuesday 25th of May 2010 02:05:10 AM
Old 05-25-2010
Hi.

As silly as it sounds, you have a space after EOF. You need to remove it.

Code:
#!/bin/ksh
#-------------------------------------------------------------------------
# File: ang_stdnld.ksh
#
# Desc: UNIX shell script to extract Store information.
#-------------------------------------------------------------------------
### Set the global variables.
CONNECT=$1
LOG=$MMHOME/log/ang_stdnld_`date +'%b_%d'`.log
ERR=$MMHOME/error/err.ang_stdnld.`date +'%b_%d'`
##SCRIPT_HOME=$MMHOME/oracle/proc/bin
### Check if path where extracts are to be created is passed as arg.
### If this arg is Null, then default to PWD.
if [ "$2" = "" ]
then
DIR=`pwd`
echo "Path is not sent. Defaulting to PWD: "`pwd`
else
if [ -d $2 ]
then
DIR=$2
else
echo "Path $2 does not exist"
exit 1
fi
fi
#-------------------------------------------------------------------------
# Function Name: ang_get_chain()
# Purpose : Create store listing that needs to be processed to
# extract the data.
#-------------------------------------------------------------------------
ang_get_chain()
{
echo "Getting the chain name...\n" >>$LOG
# Set filename to contain this chain 
CHAIN=$DIR/stdnld_chain.lst 
$ORACLE_HOME/bin/sqlplus -s $CONNECT <<EOF >>$CHAIN
set pause off
set echo off
set heading off
set feedback off
set verify off
set pages 0
select distinct sh.chain
from store st,
store_hierarchy sh,
period p
where st.store = sh.store
and p.vdate between st.store_open_date and nvl(st.store_close_date,p.vdate)
order by chain;
EOF 
if [ `grep "^ORA-" $CHAIN | wc -l` -gt 0 ]
then
cat $CHAIN >> $ERR
remove_files
echo "ORA Error while creating Chain listing in ang_get_chain()." >> $LOG
exit 1
fi
for i in `cat $CHAIN`
do
returnedchainvalue=`$ORACLE_HOME/bin/sqlplus -s $CONNECT <<EOF
set serveroutput on;
set pause off
set echo off
set heading off
set feedback off
set verify off
set pages 0
Declare
message VARCHAR2(200);
Begin
select ANGELIC_PKG.ANG_GET_CHAIN_NAME($i) into message from dual;
dbms_output.put_line (message);
End;
/
set serveroutput off;
EXIT;
EOF` 
X=`echo $returnedchainvalue` 
$ORACLE_HOME/bin/sqlplus -s $CONNECT <<EOF >>${X}_en-us_stores_001
SELECT S.STORE, 
S.STORE_NAME, 
S.PHONE_NUMBER, 
A.ADD_1, 
A.ADD_2, 
A.CITY, 
A.STATE, 
A.POST, 
A.COUNTRY_ID, 
'HOMEPAGE', 
'HOURS', 
'CATEGORY', 
'DESCRITPION', 
S.CURRENCY_CODE, 
S.STORE_OPEN_DATE, 
'LATITUDE', 
'LONGITUDE'
FROM STORE S, 
ADDR A, 
STORE_HIERARCHY SH
WHERE A.MODULE='ST'
AND A.COUNTRY_ID='US'
AND A.KEY_VALUE_1=S.STORE
AND A.ADDR_TYPE=01
AND S.STORE=SH.STORE
AND SH.CHAIN=$i;
EOF
done
}
#-------------------------------------------------------------------------
# Function Name: remove_files()
# Purpose : Clean the temporary files created.
#-------------------------------------------------------------------------`
remove_files()
{
echo "Removing temporary files...\n" >> $LOG
# Clean up temp list files.
rm -f $CHAIN_LIST
if [[ -s $ERR ]]
then
:
else
rm -f $ERR
fi
return 0
}
### end remove_files

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

0403-057 Syntax error at line 70. pls help

Hi All, I got a script from one of the unix forums for reporting on filesystem usage and wanted to use it but it keeps giving me the following error. 0403-057 Syntax error at line 70 The script is shown below. Pls help as I am new to UNIX. # set -x # D I S K S P A C E . S H # #... (2 Replies)
Discussion started by: OMONI
2 Replies

2. Shell Programming and Scripting

get_source[34]: 0403-057 Syntax error at line 66 : `"' is not matched.

Hi, I am getting this error in my shell script, kindly help as soon as possible: ################################################################### # Main body of program ################################################################### . /saptech/scripts/common/declare # Defines... (1 Reply)
Discussion started by: vishal_ranjan
1 Replies

3. Shell Programming and Scripting

0403-057 Syntax error at line 52 : `)' is not expected.

Can someone please tell me wht is wrong with the following peice of code? I keep getting the following error - 0403-057 Syntax error at line 52 : `)' is not expected. case "${option_count}" in 1) java -Xms256m -Xmx1536m "${APPLNAME}" "${ACTION_TYPE}" > "${LOGFILE}" 2>... (2 Replies)
Discussion started by: Veenak15
2 Replies

4. Shell Programming and Scripting

ksh: 0403-057 Syntax error: `done' is not expected.

Hi I am getting error 'ksh: 0403-057 Syntax error: `done' is not expected.' when running below script any one can provide inputs on this. ------------------------ if then echo "Report Name |Modification Date|Report File Size|Owner" >SOX_`date +'%Y%m%d'` while read line do... (2 Replies)
Discussion started by: karnatis
2 Replies

5. Shell Programming and Scripting

0403-057 Syntax error

I am getting the error : rocfm/wls_subload/in/processed_files/tel_input_additional_checked_all_mandatory.txt: 0403-057 Syntax error at line 1 : `|' is not expected. >>>>ALL MANDATORY FIELDS CHECKING IS SUCCESSFUL count is 0 ... (3 Replies)
Discussion started by: princetd001
3 Replies

6. Shell Programming and Scripting

0403-057 Syntax error at line 169 : `"' is not matched.

Hi, I am getting this error in my attached shell script, kindly help as soon as possible: Thanks, Andre (2 Replies)
Discussion started by: damoon
2 Replies

7. Shell Programming and Scripting

0403-057 Syntax error at line : `}' is not expected.

i dont know where m i mistaking.. please help me out with this issue :( thanks in advance:rolleyes: one_main() { a=100 while ; do clear echo "##############################################" echo ":: CURRENTLY YOU ARE IN RC AND OC MARKING ::" echo... (1 Reply)
Discussion started by: Puneet sinha
1 Replies

8. AIX

0403-057 Syntax error at line 17 : `(' is not expected.

Hi, I am new to shell scripting.i am trying to mail after my backup completed. Here is my shell script: if ; then egrep (ERROR|error|Error|RMAN-) ${/backup/RMANBKUP/spool/shelltest.log} > /dev/null if ; then RESULT_MSG=WARNING: Errors occurred during the ${ORACLE_SID} Rman... (3 Replies)
Discussion started by: faruqms
3 Replies

9. Shell Programming and Scripting

0403-057 Syntax error at line 17 : `(' is not expected.

Hi, While executing my code i am getting below Error: ./check_disk1: 0403-057 Syntax error at line 55 : `(' is not expected. My code is : #!/bin/ksh PROGNAME=`basename $0` STATE_OK=0 STATE_WARNING=1 STATE_CRITICAL=2 STATE_UNKNOWN=3 OS=$(uname) AWK="/usr/bin/awk"... (6 Replies)
Discussion started by: abodage
6 Replies

10. Shell Programming and Scripting

0403-057 Syntax error at line 399 : `"' is not matched

Hi Everyone, I am getting strange behavior, same script runs fine without any error in one AIX machine, whereas on another it is throwing this error "0403-057 Syntax error at line 399 : `"' is not matched", I also ran the script in debug mode. This is the output, still doesn't say anything.... (2 Replies)
Discussion started by: sid1987
2 Replies
echo(1) 							   User Commands							   echo(1)

NAME
echo - echo arguments SYNOPSIS
/usr/bin/echo [string...] DESCRIPTION
The echo utility writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. If there are no arguments, only the NEWLINE character will be written. echo is useful for producing diagnostics in command files, for sending known data into a pipe, and for displaying the contents of environ- ment variables. The C shell, the Korn shell, and the Bourne shell all have echo built-in commands, which, by default, will be invoked if the user calls echo without a full pathname. See shell_builtins(1). sh's echo, ksh's echo, and /usr/bin/echo understand the back-slashed escape charac- ters, except that sh's echo does not understand a as the alert character. In addition, ksh's echo, does not have an -n option. sh's echo and /usr/bin/echo only have an -n option if the SYSV3 environment variable is set (see ENVIRONMENT VARIABLES below). If it is, none of the backslashed characters mentioned above are available. csh's echo and /usr/ucb/echo, on the other hand, have an -n option, but do not under- stand the back-slashed escape characters. OPERANDS
The following operand is supported: string A string to be written to standard output. If any operand is "-n", it will be treated as a string, not an option. The following character sequences will be recognized within any of the arguments: a Alert character.  Backspace. c Print line without new-line. All characters following the c in the argument are ignored. f Form-feed. New-line. Carriage return. Tab. v Vertical tab. \ Backslash. n Where n is the 8-bit character whose ASCII code is the 1-, 2- or 3-digit octal number representing that character. USAGE
Portable applications should not use -n (as the first argument) or escape sequences. The printf(1) utility can be used portably to emulate any of the traditional behaviors of the echo utility as follows: o The Solaris 2.6 operating environment or compatible version's /usr/bin/echo is equivalent to: printf "%b " "$*" o The /usr/ucb/echo is equivalent to: if [ "X$1" = "X-n" ] then shift printf "%s" "$*" else printf "%s " "$*" fi New applications are encouraged to use printf instead of echo. EXAMPLES
Example 1: Finding how far below root your current directory is located You can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o Echo your current-working-directory's full pathname. o Pipe the output through tr to translate the path's embedded slash-characters into space-characters. o Pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo $PWD | tr '/' ' ' | wc -w See tr(1) and wc(1) for their functionality. Below are the different flavors for echoing a string without a NEWLINE: Example 2: /usr/bin/echo example% /usr/bin/echo "$USER's current directory is $PWDc" Example 3: sh/ksh shells example$ echo "$USER's current directory is $PWDc" Example 4: csh shell example% echo -n "$USER's current directory is $PWD" Example 5: /usr/ucb/echo example% /usr/ucb/echo -n "$USER's current directory is $PWD" ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of echo: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. SYSV3 This environment variable is used to provide compatibility with INTERACTIVE UNIX System and SCO UNIX installation scripts. It is intended for compatibility only and should not be used in new scripts. EXIT STATUS
The following error values are returned: 0 Successful completion. >0 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
echo(1B), printf(1), shell_builtins(1), tr(1), wc(1), ascii(5), attributes(5), environ(5), standards(5) NOTES
When representing an 8-bit character by using the escape convention n, the n must always be preceded by the digit zero(0). For example, typing: echo 'WARNING:7' will print the phrase WARNING: and sound the "bell" on your terminal. The use of single (or double) quotes (or two backslashes) is required to protect the "" that precedes the "07". Following the , up to three digits are used in constructing the octal output character. If, following the n, you want to echo addi- tional digits that are not part of the octal representation, you must use the full 3-digit n. For example, if you want to echo "ESC 7" you must use the three digits "033" rather than just the two digits "33" after the . 2 digits Incorrect: echo"0337 | od -xc produces: df0a (hex) 337 (ascii) 3 digits Correct: echo "00337" | od -xc produces: lb37 0a00 (hex) 033 7 (ascii) For the octal equivalents of each character, see ascii(5). SunOS 5.10 20 Jan 2000 echo(1)
All times are GMT -4. The time now is 06:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy