Maybe the script does not have the executable permission set?
Aside from that, you cannot execute it in a subshell (using the sh
command), because you are exporting the variable to shells created from that subshell, but that subshell is going to die immediately, and you are going to return to the parent shell (the interactive one), with the PS1
variable unchanged.
To fix it, you must source
the script, executing it with:
. dprompt.sh
That way, the script is execute in the current shell, without issuing a new one, so the variable is changed for the current shell.