LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-20-2011, 01:42 PM   #1
newtoshl
LQ Newbie
 
Registered: Jun 2011
Posts: 1

Rep: Reputation: Disabled
If the file does not exists, do the control file


This piece of code is working somewhat.
I need to search for a file in a directory
It is define, if the file is there execute the control file, if it is not there don't execute the ctl file (sqlldr), it is executing the sqqlldr all the time, I added the if statement(commented out)
##if [ -f "$pfile_fq" ]
but it is not working

{code}
##if [ -f "$pfile_fq" ]
##then
export PATH=/usr/local/bin:$PATH
export ORACLE_SID=$1
export ORAENV_ASK=NO
. oraenv
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME:$ORACLE_BASE
#echo $PATH
#echo $ORACLE_SID
echo "Running command: /u01/app/oracle/product/11.2.0/bin/sqlldr xxx/xxx@${1} control=/u01/app/banner/test/sub/plus/ssearc
h_ctl.sql log=$pbase/$log_file"
/u01/app/oracle/product/11.2.0/bin/sqlldr xxx/xxxx@${1} control=/u01/app/banner/test/sub/plus/ssearch_ctl.sql log=$pbase/$l
og_file
##mv $pfile_fq $pfile_mv
##else
# #printf "\nthe file does not exist: \n"
## echo "The file does not exist: $pfile_fq"
##fi
{code}
 
Old 06-20-2011, 02:00 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Hi, welcome to LQ!

You almost got the code tags right ;} try [ code ] and [ /code ]
(w/o the spaces between brackets and "code").


Try this:
Code:
if [ -f "$pfile_fq" ] ; then
  export PATH=/usr/local/bin:$PATH
  export ORACLE_SID=$1
  export ORAENV_ASK=NO
  . oraenv
  export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME:$ORACLE_BASE
  echo $PATH
  echo $ORACLE_SID
  echo "Running command: /u01/app/oracle/product/11.2.0/bin/sqlldr xxx/xxx@${1} control=/u01/app/banner/test/sub/plus/ssearch_ctl.sql log=$pbase/$log_file"
  /u01/app/oracle/product/11.2.0/bin/sqlldr xxx/xxxx@${1} control=/u01/app/banner/test/sub/plus/ssearch_ctl.sql log=$pbase/$log_file
  mv $pfile_fq $pfile_mv
else
 printf "\nthe file does not exist: \n"
 echo "The file does not exist: $pfile_fq"
fi


Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating mailbox file: File exists thomas2004ch Linux - Software 5 07-28-2015 05:19 PM
[SOLVED] Bash: No such file or directory, when file actually exists. SkyerSK Linux - Software 13 02-06-2011 04:33 AM
webdav: File exists error while creating new file rdo Linux - Server 3 06-20-2010 11:30 AM
SIOCADDRT: File exists SIOCCADDRT: File Exists Failed to bring up eth0. opsraja Linux - Networking 0 01-10-2005 08:29 AM
Linker problem: can't find a file, but the file exists atlep Programming 5 08-16-2004 06:15 AM


All times are GMT -5. The time now is 02:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration