It isn't clear from your question exactly where and when you are running the scriptlet that you presented.
After you run the scriptlet do
cat /etc/bash.bashrc to see if the two export lines are there.
The scriptlet adds two lines to
/etc/bash.bashrc each time it runs. If you run it twice then you will have duplicate lines. The file
/etc/bash.bashrc is a regular configuration file, not regenerated every boot, so any changes you make are persistent. So, you probably only want to run this script once on each platform you install it on.
In any event,
/etc/bash.bashrc is probably not a good place to put global additions to
PATH. You put those in
/etc/profile. But before you do that, do
echo $PATH to verify that
/usr/local/bin isn't already there. In most distributions it is included in the PATH out-of-the-box.
Changes that you make to
/etc/bash.bashrc will be effective for new
bash processes such as terminal windows running
bash that you start after you make the change. The change does not effect currently running windows.
PATH environment variable that you set in
/etc/profile of in a
.bashrc file affects only bash shells. If you start a program from
at or from an
/etc/rc.d file, then you need to set the
PATH specifically in those scripts, or use the
etc/environment file to set environment variables for all processes. See this link that explains the differences.