If hiding the script's source code is the goal, you may want to look at shc. Note, I've never actually used this until today. It works, at least for my simple one line script /bin/sh test script.
Otherwise, you can try using gpg to encrypt the script and give each user the password. Basically, you take your finished shell script, then encrypt it to armored ASCII format:
gpg -ca foo.sh
Then you take the resulting "foo.sh.asc" file, then wrap it in another script:
cat <<EOF | gpg -d | /bin/sh
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.10 (FreeBSD)
-----END PGP MESSAGE-----
The password is "test1". The encrypted script is:
While I give you my word that my script is safe, don't make a habit of running such scripts from strangers, since you have no reason to trust me and I could potentially do something devious with my encrypted script. :-)
Unfortunately, a sufficiently savvy user will be able to recover the script plain text by simply removing the "| /bin/sh" portion from the script, which will result in the script being dumped to stdout.
In short, if the end user can run the script, it is possible (with enough motivation and skill) to reverse engineer it. Don't place anything of critical importance (such as passwords) into these obfuscated scripts.