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 5981375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:56:06+00:00 2026-05-22T21:56:06+00:00

The project I work on has some executable scripts in the repository. These scripts

  • 0

The project I work on has some executable scripts in the repository. These scripts are actually tools that automate some development tasks and I invoke them only when I’m inside the repo and they work only on files in the repo. My typical working session looks like this:

$ cd $REPO
$ ./tools/start-session
$ some-script some arguments
$ other-script other arguments

In other words, the start-session script just adds an appropriate entry to the $PATH variable.

I’d like to automate it further so that I don’t have to call the $REPO/tools/start-session script. What I’d like to achieve is to make bash automatically detect that I’m in my repo dir and append proper entry to $PATH. The point is that I have many working copies of my repo and the tools differ a bit in each branch, I move between working copies frequently and I’d like my shell to kind of guess which script I want to invoke.

How do I do that?

The only thing I can think of is that the $PS1 variable gets executed each time a command is completed, so I could somehow hook some $PATH-changing script in there using backticks, i.e. do some thing like

PS1=`update-path`$PS1

But this seems not the right way.

  • 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-22T21:56:07+00:00Added an answer on May 22, 2026 at 9:56 pm

    On the right track, but don’t use PS1 – you want PROMPT_COMMAND. For example:

     PROMPT_COMMAND='ls'
    

    will execute ls every time a new prompt appears. Whether this will solve you root problem I couldn’t say, as I’m not sure I understand it properly.

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

Sidebar

Related Questions

I have had many requests come in to a project that I work on,
I work on a project that uses multiple open source Java libraries. When upgrades
The project I work on has recently been switched from a horribly antiquated revision
I'm looking for some architecture ideas on a problem at work that I may
I've been doing a project at work recently focused on an almost entirely client-driven
I am starting a new client/server project at work and I want to start
I recently got involved in a Java project at work: we're using MyEclipse for
We are ready to start a brand new project at work, no legacy code.
I'm investigating using hosted subversion for a new project at work and was wondering
I'm trying to work through Project Euler and I'm hitting a barrier on problem

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.