BASH: matching a directory in the middle of a path

25 pts.
Tags:
Bash
Linux administration
Unix shells
Unix tools
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]

Answer Wiki

Thanks. We'll let you know when a new response is added.

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.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Landocalvinian
    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 pointsBadges:
    report
  • petkoa
    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 pointsBadges:
    report
  • Landocalvinian
    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 pointsBadges:
    report
  • petkoa
    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 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following