The stock OS X box comes with enough of the standard command-line toolbox that if you are actually writing a "portable" script you are not going to have a problem running that script on OS X. The biggest differentiator is probably that OS X is a part of the *BSD lineage and so you will need to do more tweaking of a Linux script to get it bsd-ready than you will need to tweak a standard bsd script to move it from FreeBSD to OS X. While macports is closer to the freebsd port system, it is close enough to apt-get that you should really have no problems switching from one to the other.