Question

I am executing

#!/bin/bash

PARTITION_LOG=../log/auto_partition.log

PATH=../sql/

cd $PATH
SQL_FILES=`/bin/ls *.sql`
echo "$SQL_FILES"

for File in $SQL_FILES
do
    if [ -f  $File ]

    then

    f=$File

    fi

$ORACLE_HOME/bin/sqlplus -silent username/password@database << _EOF_ > $PARTITION_LOG
    set head on echo off linesize 300 feedback off trim on trimspool on verify off
    spool $PARTITION_LOG
    @$f
    spool off
_EOF_

done

../sql/ contains 4 files

A.sql,B.sql,C.sql,D.sql 

I don't want to execute D.sql.

the above code is executing all $ files.

Was it helpful?

Solution

Changing the line

SQL_FILES=`/bin/ls *.sql`

to

SQL_FILES=`/bin/ls [^D]*.sql`

should exclude D.sql.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top