The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
grep with variable ozvena Shell Programming and Scripting 5 05-14-2008 04:05 PM
question on sed grep awk from variable 3Gmobile Shell Programming and Scripting 9 08-11-2006 01:15 AM
define length of variable cbarker UNIX for Dummies Questions & Answers 10 04-01-2005 01:42 PM
How to grep a variable? whatisthis Shell Programming and Scripting 2 09-14-2004 07:26 PM
How to define two variable in foreach command?? geoquest Shell Programming and Scripting 14 08-22-2002 07:11 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-12-2001
cspcspcsp cspcspcsp is offline
Registered User
  
 

Join Date: Oct 2001
Posts: 1
Using Grep to Define a Variable

I am using korn shell unix.

I have a script that I am working with to do a check for me using a text file.



#finds "Time" from the text file and cuts the second field from the #line

A= grep Time test.txt | cut -f2


# the "#Missing" is being pulled from the second field of the text #file

if [ "$A" = #Missing ]
then
echo "page me"
fi



My problem is that I am unable to get the 'echo "page me"' to echo back onto the screen. This tells me that the check isn't successful- or at least that is what I think it is telling me.

My if statement may be incorrect- I've tried '-eq', but no luck there either.

I'm also not certain if I can use grep to try and define a variable. I've even attempted to use awk. Everything works on the command line, by itself (like running the grep command).

Anyone have any ideas? I'm pretty new at Unix.

Thanks,

Chris
 

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 04:07 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