Pentaho shell script with “Copy previous results to args?” = Y and “Execute for every input row?” = Y escapes parameters incorrectly in linux

StackOverflow https://stackoverflow.com/questions/8945058

  •  07-11-2019
  •  | 
  •  

Question

I have seen references to similar issues, but not this exact one. I have a simple Pentaho Job with four steps. The first is a start. The second is a transform, that makes a DB query call and returns 3 rows. Before the transform ends (the last step of the Transform), it calls the 'Copy Rows to Results' step. I think by using this, I can use the results of the query in my Job. My third step (of my Job) calls a script I have written. I have both "Copy previous results to args?" and "Execute for every input row?" both checked. My script is called "/home/myid/echo-me.sh". All the script does is echo out $1. The last step of my Job is 'Success'.

If I run my script from the command line, it works. The command: "/home/myid/echo-me.sh helloworld" produces "helloworld", as expected. Pentaho, however, appears to call the script via "/bin/sh" like this "/bin/sh/ -c /home/myid/echo-me.sh helloworld". The parameter is not passed to my shell script in this case. I confirmed this by running it manually just like this from the command line. If I put single quotes around my script (and parameter), like this: "/bin/sh/ -c '/home/myid/echo-me.sh helloworld'", it works fine.

Unfortunately, I cannot figure out how to get Pentaho to do the same thing. Placing quotes in the "Script file name" field causes all kinds of havoc.

Interestingly, this does not appear to be an issue for Windows. It appears to correctly escape out the shell string... like this:
cmd.exe /C ""c:\mytest\echo-me.bat" helloworld"

Can anyone tell if I am doing anything wrong?? Work around?

Thanks!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top