As user @muru says, it's not possible to do because you have already left the shell session behind when you get to the #!
-line.
However, depending on what your shell files do, there might be another solution.
I'm guessing that they set environment variables that you use for some project.
Let's call a project subtool
(because that's a project I have). Then you could have a script that sets up a shell environment for projects, project-env
for example:
#!/bin/bash
PROJECT="$1"
PROJECT_ROOT="$HOME/projects/$PROJECT"
cd "$PROJECT_ROOT" || exit 1
source "$PROJECT.env"
export PS1="[$PROJECT: \W] \$ "
exec bash -i
Run with:
$ ./project-env subtool
This will automatically cd
into the given project subfolder beneath $HOME/projects
, read a project environment file called subtool.env
in this case (in which you initialize variables), give you a command line prompt for the project and leave you at an interactive bash
session:
[subtool: subtool] $
When your work is done, simply exit
.
This also has the benefit of isolating the project environment from your "ordinary" login shell session and from other projects.