I had changed some ps commands to use comm instead of cmd so they work on Mac, but it turns out comm doesn't include the arguments passed to the command (my bad for not reading the docs close enough). So I have now changed those to use args, which should work on both Linux and Mac