The UNIX and Linux Forums  

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
Returning Strings from C program to Unix shell script venkatesh_sasi High Level Programming 24 11-28-2007 04:48 AM
Comparison of 2 strings Retribution Shell Programming and Scripting 2 12-06-2006 08:35 AM
difference between AIX shell scripting and Unix shell scripting. haroonec Shell Programming and Scripting 2 04-12-2006 09:12 AM
Returning Strings from C program to Unix shell script satguyz High Level Programming 11 12-30-2005 03:41 PM
How to concatenate two strings or several strings into one string in B-shell? fontana Shell Programming and Scripting 2 08-26-2005 12:58 PM

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 01-11-2008
piscean_n piscean_n is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 2
comparison of strings in unix shell scripting

Hi


Code:
STORAGE_TYPE=$1

echo "########### SQL SESSION STARTED ###########"


VALUE=`sqlplus -S /nolog << THEEND

connect tcupro/tcupro_dev@bdd1optn 
SET SERVEROUTPUT ON
DECLARE
        V_STORAGE_TYPE   varchar2(3);
         V_ERR_MSG  varchar2(255) ;
	 V_LOG_LEVEL varchar2(200);
BEGIN

  V_STORAGE_TYPE :=  '$STORAGE_TYPE';
  V_ERR_MSG := 'SUCCESS';
  V_LOG_LEVEL := 'DETAIL';
dbms_output.put_line(V_STORAGE_TYPE);
  TCUPRO.TCU_PURGE_TABLES_DUP(V_STORAGE_TYPE, V_ERR_MSG,V_LOG_LEVEL);
dbms_output.put_line(V_ERR_MSG);

END;
/
EXIT;
THEEND`


echo $VALUE >./logs/TCU-`date '+%Y%m%d-%H%M%S'`-PURGE.log

Actuall this $value will have ' Success,Pl/sql procedure completed successfully.'
So I want to check that variable $value has success word or not.
and on the basis of that want to return exit code.
  #2 (permalink)  
Old 01-11-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,807

Code:
echo $VALUE >./logs/TCU-`date '+%Y%m%d-%H%M%S'`-PURGE.log
echo "$VALUE" | grep -q 'SUCCESS' 
return $?

will return 1 on failure 0 on success - is that what you mean?
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 07:50 AM.


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