I've been investigating using the script System call to invoke some background C programs and do some work, however I'm running into behavior contrary to the documentation.
The manual includes this example:
system"/opt/ppmac/tune/parabolicmove 1 2000 500 0 0 0";
However, when executed, I get an error that
sh: /opt/ppmac/tune/parabolicmove 1 2000 500 0 0 0: No such file or directory
This isn't super surprising; sh is being passed the entire string and is interpreting it as the executable to find, rather than as an executable followed by arguments. If I just move the quote:
system"/opt/ppmac/tune/parabolicmove" 1 2000 500 0 0 0;
this works fine - the executable is invoked with the right arguments.
Now, the crux is the other feature advertised in the manual, the ability to pass a formatted string with arguments to system. Ideally, I'd do something like
system"/opt/ppmac/app/doWork %d %d %d",pVariable1,pVariable2,pVariable3
This doesn't work for two reasons:
system "/var/ftp/usrflash/foo.out %d %d %d",10,20,30
sh: /var/ftp/usrflash/foo.out %d %d %d,10,20,30: No such file or directory
The file not being found is expected per the initial issue. However, given that, what I'd _expect_ to not be found is "/var/ftp/usrflash/foo.out 10 20 30" rather than the full pattern.
How can I format a command to the system from script? Am I doing something wrong? Is the manual wrong?