We help IT Professionals succeed at work.
Get Started

shell error(UNIX)

sam shah
sam shah asked
on
130 Views
Last Modified: 2017-06-14
#!/bin/ksh


# set umask to allow output files to be overwritten by other users

umask 000

export INBOUND_DIR=/home/ABC/IN
export ARCHIVE_DIR=/home/ABC/Archive
export LOG_DIR=/home/ABC/log
export SCRIPT_DIR=/proc/bin
date_str=$(date "+%Y%m%d%H%M%S")
cd $INBOUND_DIR
find . -type f -name "* *.csv" | while read f; do mv "$f" "$(echo "$f"|sed 's/ /_/g')";done
ls -ltr | grep -v ^d | awk '{print $9}' | while read f; do
VAR1=`echo $f`
$ORACLE_HOME/bin/sqlplus -s $MMUSER/$PASSWORD <<EOF
insert into ls_file_process_ind values('$VAR1','N',sysdate,sysdate);
delete ls_file_process_ind where FILE_NAME is NULL;
commit;
if [ -f ABC_*.csv ]
then
for data_file in $(ls -rt ABC_*.csv 2>/dev/null) ;
do
  DATA_FILE="$INBOUND_DIR/$data_file"
  BAD_FILE="$LOG_DIR/$data_file.bad"
  PAR_FILE="$INBOUND_DIR/lm_con_tsf_par.par"
  FILE_NAME="$data_file"
  LOG_FILE="$LOG_DIR/$data_file.log"

  cd $SCRIPT_DIR
  #----------------------------------------------------------------------------
  #  Load Record information.
  #----------------------------------------------------------------------------
  sqlldr $UP data=$DATA_FILE control=ls_con_tsf_ctl.ctl bad=$BAD_FILE log=$LOG_FILE errors=9999 > /dev/null

  retcode=`echo $?`
  case "$retcode" in
  0) echo "SQL*Loader execution successful" ;;
  1) echo "SQL*Loader execution exited with EX_FAIL, see logfile" ;;
  2) echo "SQL*Loader execution encountered a fatal error" ;;
  *) echo "unknown return code";;
  esac
  #----------------------------------------------------------------------------
  #  Move download data file to backup directory.
  #----------------------------------------------------------------------------
  cd $INBOUND_DIR
  mv $FILE_NAME $ARCHIVE_DIR/$FILE_NAME
 ls -ltr | grep -v ^d | awk '{print $9}' | while read f; do
 VAR1=`echo $f`
 $ORACLE_HOME/bin/sqlplus -s $MMUSER/$PASSWORD <<EOF
 update ls_file_process_ind set PROCESS_IND='Y',last_update_datetime=sysdate where FILE_NAME='$VAR1';
 commit;
 done
 else
 echo "NO files found or file name is in wrong format"
 fi


ERROR:  0403-057 Syntax error at line 28 : `<' is not matched.

Please help

Thanks in advance
Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 2 Answers and 5 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE