Have you tried calling this script from sm49? In this way the command should be executed in the SAP environment where the kernel communicates directly with the operating system.
Basically the kernel is not a DOS/UNIX interpreter so you may not be able to do exactly the same things from sm49 that you can do directly at OS level. However, sometimes there are ways to work around these issues. There is no shell in this case and while it is possible to run the very basic
unix commands, others have to be contained in a short script at OS level.