The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Delimiters missing Indalecio Shell Programming and Scripting 2 02-23-2007 04:28 AM
Missing functions HELP! sha1024 High Level Programming 1 02-05-2007 03:06 PM
missing CDE frankkahle SUN Solaris 5 05-25-2006 05:35 PM
/tmp is missing ???? BAM UNIX for Dummies Questions & Answers 1 11-05-2002 02:50 PM
/dev/fb* missing heinb UNIX for Dummies Questions & Answers 5 02-12-2002 05:22 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-13-2005
Zelp Zelp is offline
Registered User
  
 

Join Date: Jun 2005
Location: Champaign, IL
Posts: 19
Unhappy what am I missing?

I have the following portion of a script

Code:
Check()
{
echo "\n\nChecking that all constraints are Enabled"
echo "..."
sleep 2
CHECK_COUNT='sqlplus -s $1 <<-EOSQL4
set feed off pause off pages 0 head off;
set linesize 150 echo off;
select count(*) from user_constraints where status='DISABLED';"
quit;
EOSQL4'

if [ $CHECK_COUNT -eq 0 ]
then
    echo "\nThe following $CHECK_COUNT constraint(s) could not be enabled!"
    #sqlplus -s $1 <<-EOSQL
    #set feed off pause off pages 0 head off;
    #spool ref_con_errors.log;
    #select constraint_name,table_name from user_constraints where status='DISABLED';
    #spool off;
    #quit;
    #EOSQL
    #echo "\nPlease view 'ref_con_errors.log' for details on which constraints"
    echo ""
else
    echo "\nAll Constraints are enabled"
    echo ""
fi
}
this is the output I get from it:

Checking that all constraints are Enabled
...
Check[12]: -s: unknown test operator

All Constraints are enabled


How do I get rid of this error?

Thanks,
Zelp
  #2 (permalink)  
Old 06-13-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,728
Code:
CHECK_COUNT='sqlplus -s $1 <<-EOSQL4
set feed off pause off pages 0 head off;
set linesize 150 echo off;
select count(*) from user_constraints where status='DISABLED';"
quit;
EOSQL4'
See the two red tick marks - they need to be backtick characters.
Remove the red dash
  #3 (permalink)  
Old 06-13-2005
Zelp Zelp is offline
Registered User
  
 

Join Date: Jun 2005
Location: Champaign, IL
Posts: 19
i tried that and now I get

Checking that all constraints are Enabled
...
Check[12]: ORA-01740:: unknown test operator

All Constraints are enabled


anymore help?
  #4 (permalink)  
Old 06-13-2005
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
Code:
if [ "$CHECK_COUNT" -eq 0 ]
also it seems like your sql does not return a NUMBER.... debug it stand-alone first.

select count(*) from user_constraints where status='DISABLED';"
  #5 (permalink)  
Old 06-13-2005
Zelp Zelp is offline
Registered User
  
 

Join Date: Jun 2005
Location: Champaign, IL
Posts: 19
yeah, it was that darn quote after 'DISABLED';

and BTW, you can leave the (minus) in the <<-EOSQL4

by adding the minus it removes any un-wanted TAB characters in the SQL.

Thanks so much guys!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:29 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0