Sure, but if the payload in this example is a Linux binary then it won't do anything to an OSX/BSD/Windows machine.
If the payload is an interpreted script, or something that's compiled (if it can find a compiler, etc) then it may be able to infect different OSes.