Re: Sort of OT - problem with "find" cmd inside ksh script
From: Chris Mattern (syscjm_at_gwu.edu)
Date: Mon, 05 Jan 2004 17:05:45 -0500
James F. Cornwall wrote:
> nulldiff=`find . -name diff.* -size 0 -print`
> When I run it, though, I get:
> find: paths must precede expression
> Usage: find [path...] [expression]
> If I change the script to use "find . -size 0 -print" it works, but I
> really want to limit it to only deleting the zero-size diff files...
> Any ideas?
"diff.*" is matching files in your current directory, so the shell
is thoughtfully doing the expansion for you. What find is getting
as a parameter is not "-name diff.*" but
"-name diff.this diff.that diff.theother", which isn't valid.
You need to use quotes to stop the shell from expanding the wildcard:
nulldiff=`find . -name "diff.*" -size 0 -print`