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 UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-21-2007
guarriman guarriman is offline
Registered User
 

Join Date: Feb 2007
Posts: 1
How to include a variable between apostrophes within a command

Hi.

I'm trying to find some words within my directory and created a text file containing them which is read by my shell script:
Code:
#!/bin/bash
var=`cat words.txt`
for i in $var; do
	echo $i
        find -type f -print0 | xargs -r0 grep -F '$i'
done
But it searches "$i" (dollar sign with 'i'), and not the word. How to do it?

Thank you very much.
Reply With Quote
Remove advertisements
!!
Forum Sponsor