25 pts.
 BASH: matching a directory in the middle of a path
How can I do this in bash? find . -name '*!{*}*' -ls Cf. UNIX Power Tools, page 175. This works in tcsh, but no in bash. In bash I get this message: ff CH18 find: paths must precede expression Usage: find [-H] [-L] [-P] [expression]

Software/Hardware used:
ASKED: June 6, 2009  2:39 AM
UPDATED: June 15, 2009  4:44 PM

Answer Wiki:
I think your version of bash may be just too old. I tried this command in version 3.2-23 and it worked without error.
Last Wiki Answer Submitted:  June 9, 2009  3:39 pm  by  Djeepp   340 pts.
All Answer Wiki Contributors:  Djeepp   340 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Thank you, Djeepp.

I downloaded bash 4.0 and now I get data, but it is way more than I expect.
Basically a find . -print.

???/

 25 pts.

 

Hi,

this message basically means that some parameter expansion happened in the shell and expanded parameter to -name confused find.

In this example I would backslah-escape the curly brackets… though tested it in bash 3.0, and it works in your original syntax…

What was you initial bash version?

BR,

Petko

 3,120 pts.

 

Hello, Petkoa

Here’s the answer to your version question:

GNU bash, version 3.2.13(1)-release (i486-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

 25 pts.

 

Well, then – it works with 3.0 and 4.0 – there should be no reasons not to work under 3.2 (at least I can’t recall any changes in quoting/escaping that took place after 3.0 (and were reversed in 4.0)… The find expression may not work in double-quotes (though, in my environment it works), but should work in single-quiotes, as you posted it. I’m really puzzled.

BR,

Petko

 3,120 pts.