How can I compile binary shell script for FreeBSD? I tried the Linux binary emulator but it doesn't work.
There is really no such thing as a binary shell script (script means not binary) - although it is possible to tack an executable binary or a compressed file on the end of a shell script, which usually just contains a tail command to strip the shell script and decompress/preprocess and execute the binary.
If correctly set up the script should include the shell to use (#!/bin/sh would be the traditional unix default), or should use only commands common to all shells. Simple thing is to make it readonly for safety and open it with vi and have a look, and then just execute the payload command(s) on the file yourself (with adjustments as needed - often the point is to set up some environment variables or do some preprocessing, most often including decompression).
Some scripting languages like e.g. Python convert scripts into bytecode before executing them. Shells that can be used interactively usually don't, they are just interpreters.
One could even argue that save for some embelishments like variables, loops and other control structures, shells are mostly a front-end for the