This question already has an answer here:

I have multiple projects, say, in Python. In each project I have "scripts/main_script.sh". Is there any way to make "scripts/main_script.sh" execute automatically when I go to the base directory of a project?

Namely, when I do cd /home/my_name/python_project123, the script /home/my_name/python_project123/scripts/main_script.sh should execute automatically.

marked as duplicate by Jeff Schaller, RalfFriedl, thrig, mosvy, JigglyNaga Nov 19 '18 at 18:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • only once, or every time you cd there? – Jeff Schaller Nov 19 '18 at 17:28
  • @JeffSchaller both, depending on my choise. but at least one of them. – nylypej Nov 19 '18 at 17:30
  • @JeffSchaller where should I put that script into? – nylypej Nov 19 '18 at 17:31
  • I'd suggest ~/.bash_profile or ~/.bashrc – Jeff Schaller Nov 19 '18 at 17:33