LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Shell quoting mystery

[ILUG] Shell quoting mystery

Darragh Bailey felix at compsoc.nuigalway.ie
Fri May 23 16:51:34 IST 2008


On Fri, May 23, 2008 at 03:29:32PM +0100, Lars Hecking wrote:
> 
> > The problem is that \* is not converted to * during variable expansion.
> > For that to occur you need to explicitly evaluate the command again by
> > prepending the `find` command line with `eval`. I.E.
> > 
> > eval find /home ....
> 
>  Doesn't seem to work:
> 
> ++ eval find /home -type d -name .snapshot -prune -o -type f '\(' -name 'core.\*' -o -name core -o -ctime +2 -name '.nfs\*' -o -name .xsession-errors '\)'
> +++ find /home -type d -name .snapshot -prune -o -type f '(' -name 'core.*' -o -name core -o -ctime +2 -name '.nfs*' -o -name .xsession-errors ')'
> 
>  But it must be related to the prentheses surrounding the expression.
>  Using \( or ')' lets eval fail, so I used '\)', with the result above.
>  "\(" will also not work.

I'll grant you that it doesn't remove the quotes, but with the \*
resolved to * that shouldn't be an issue anymore. It may not be solved
the way you expected, but it looks to me like it is solved.

FINDRX_C="-name core.\* -o -name core"
FINDRX="${FINDRX_C}${FINDRX_N}${FINDRX_X}"
d="${HOME}"

eval find ${d} -type d -name .snapshot -prune -o -type f \\\( ${FINDRX}
\\\)

After running "touch core core.o" in ~, the script above has no problems
in finding the two files.

So what's missing?


-- 
Darragh

"Nothing is foolproof to a sufficiently talented fool."



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell