Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find cmd using variable in -name option

Status
Not open for further replies.

cptk

Technical User
Mar 18, 2003
305
US
In ksh shell I have ...

find . -name 'cp*'

which finds all files beginning with "cp" ... great!!!

BUT, I want to be able to have a variable in liu of the "cp*" like this:

var="'cp*'"
find . -name $var

or ...
var="cp*"
find . -name '$var'


Is there a way to escape the filename metacharacter "*" in this example?



 
...nevermind !!

I could use this ...

var="cp*"
find . -name "$var"



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top