Well, there was a long debate about the actual necessity of hiding source code to the users, here at LQ. I don't reprise it now, but look for script encryption or something similar in the LQ search engine if you are interested in the subject.
The only way I tested (just out of curiosity) to hide script content is converting the script into an executable using the
shc utility. You can keep your code safe under root's home and make the executable available to the users, e.g. under /usr/local/bin. However, every time you modify the source code, you have to create the executable again.
More in detail, you have to launch the shc utility with the proper options (see the man page). This will create the C source code and the executable itself. Just move the executable to /usr/local/bin (just an example) and eventually rename it and set the permission to make it executable by the users.
Anyway, I tested shc on very simple scripts. You have to test it deeply before make the resulting executable available to the users.