The UNIX and Linux Forums  


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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-25-2008
jerryte jerryte is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 1
Compare string to a pattern

I am new to unix and need to learn how to compare a variable $subject to a string pattern. If the variable has the word "Item" in it then it should be true. How do I do this? Currently I am using the Bourne shell but I can also use Korn or Bash.

I come from a Rexx background where strings are easy:
IF WORDPOS('Item', subject) > 0 THEN
SAY 'Found it'
END