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 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've been tasked to work on a project that has some confusing attributes. The
I work against a repository that has a large number of projects. Because of
Suppose I have a project MyFramework that has some code, which is used across
I have an assembly (class library project in .Net 3.5) that has some references
Project#1 has some interfaces and classes that project#2 references. Now I want to use
I am currently on a short research project. The company I work at has
Some of the developers on the project I work on have a habit of
I need some help with a work project I have been assigned. At the
The project I work on has recently been switched from a horribly antiquated revision
I'm working on a new project which has some complex javascript. I can't post

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.