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
Unix code to fetch the first field till space in a variable autosys_nm Shell Programming and Scripting 3 08-27-2008 05:05 AM
How to pass the result of an anonymous pl/sql block back to a shell script variable ttunell Shell Programming and Scripting 2 08-01-2008 04:36 PM
fetch string and insert later playinmel.com Shell Programming and Scripting 6 07-17-2008 10:53 PM
dev/rmt 0.1 block size is 0; variable; must be 1024 fixed. MariaLuisa AIX 2 12-08-2006 04:27 AM
Compare the content of a variable with a string robdai UNIX for Dummies Questions & Answers 2 11-01-2005 07:29 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 08-30-2008
khushboo khushboo is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 3
How to fetch variable value in if block and to compare it with certain string

Hi,

I am trying to execute this command

if [ `$exception_info | grep "Exception if any" > /dev/null 2>&1; echo $?` -eq 0 ]; then

but getting error .Some problem with reteriving the value of $exception_info.
Please help.Its urgent.

thanks
  #2 (permalink)  
Old 08-30-2008
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,400
try this..
Quote:
if [ `echo "$exception_info"|grep -w "Exception if any" > /dev/null 2>&1; echo $?` -eq 0 ]; then
  #3 (permalink)  
Old 08-30-2008
khushboo khushboo is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 3
not working

Its skipping this if block.
  #4 (permalink)  
Old 08-30-2008
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,400
Quote:
Originally Posted by khushboo View Post
Its skipping this if block.
run your script as sh -x scriptname
then post the out put..
  #5 (permalink)  
Old 08-30-2008
khushboo khushboo is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 3
worked :)

hey thanks a lot.It worked ,i was not using double quote thts why i was getting the error.

thanks
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 10:58 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