Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7655967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:39:01+00:00 2026-05-31T12:39:01+00:00

I want to create script which use find like this: find . -regex $1

  • 0

I want to create script which use find like this:

find . -regex $1 | while read prom; do
    echo $prom
done

I want to get regex from option but I can´t get this working. I tried use some regex (f. e. “.*(txt)§” ) direct instead of $1 but it didn´t help. What I forget about using find?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:39:03+00:00Added an answer on May 31, 2026 at 12:39 pm

    Is there any reason you have brackets there? Try .*txt$ as your regex (not that funny “section symbol” sign in your question).

    If you did want the brackets (as capturing brackets?) you have to do .*\(txt\)$, because the default regex type for find is Emacs-style, in which () are literal and have to be escaped to be interpreted in their regex sense.

    You can also do find . -regextype posix-extended -regex '.*(txt)$', noting the -regextype posix-extended which changes the regex to extended POSIX regex, where () are special characters (find -regextype asdf will usually give you an error message listing all the options you can feed in for regextype).

    Also, in your bash script, you should surround the $1 in quotes :

    find . -regex "$1"
    

    (Unless $1 is already fed in with quotes around it, in which case disregard the suggestion).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create an HTTPURLConnection to a PHP script and get the HTTP
I want to create a script that parses or makes sense of apache's error
I want to create an SQL script that creates a database. Right now, I
I want to create a simple bash script to launch a Java program on
I want to create some kind of AJAX script or call that continuously will
Is it possible to change current directory from a script? I want to create
I have a script that create a new div element. Then, I want to
I'd like to create something similar to the shirt-designer feature found on this site:
I want to create application to fetch the current location data using Java script.
I need to create an application dll, script or exe which when the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.