bsd support for javascript.sh, thanks to @fleximus