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

  • SEARCH
  • Home
  • 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 8738309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:42:25+00:00 2026-06-13T10:42:25+00:00

I have few repositories and each have config.php file that contain information about database

  • 0

I have few repositories and each have config.php file that contain information about database like password. I have script that connect to database using stuff from that file and need to search back in directory tree so I can call it in every nested directory.

[ -e config.php ] && $(php -r 'require("config.php"); echo "mysql -u".$config["db_user"] . " -p".$config["db_pass"] . " " . $config["db_name"];')

What is easiest way to search back in directory tree using Bash?

  • 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-06-13T10:42:26+00:00Added an answer on June 13, 2026 at 10:42 am

    This chops off a directory from the end of PWD until it becomes empty. Some care may need to be taken in the presence of links.

    S="${PWD}"
    while [ -n "${S}" ]
    do
        [ -e "config.php" ] && ls $S/
        S=${S%/*}
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a few repositories that all generally look like this public class DepartmentsRepository
We have quite a few validation methods that need to access repositories / database
So I have a few private git repositories that are different language implementations (Python,
We have quite a few repositories with submodules and we would like to report
I have few jar files which I am not getting from any repositories.I have
I have few questions about ssis transction isolation levels. consider a scenario:I have an
i have few confusion regarding ORM(Object Relational Mapping) i am thinking about to use
I have few text fields like SSN , phone number and email id. I
I have a Maven project that was built a few years back, and now
I have a few repositories in Mercurial with the following structure: Core Integration Admin

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.