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.

  • 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