Pentaho shell 脚本“将以前的结果复制到参数?” = Y 和“对每个输入行执行?” = Y 在 Linux 中错误地转义参数
我看到过类似问题的参考,但不是这个问题。我有一个简单的 Pentaho 工作,有四个步骤。首先是一个开始。第二个是转换,它进行数据库查询调用并返回 3 行。在转换结束之前(转换的最后一步),它调用“将行复制到结果”步骤。我认为通过使用这个,我可以在我的作业中使用查询的结果。我(工作的)第三步调用我编写的脚本。我有两个“将以前的结果复制到参数?”和“对每个输入行执行?”都检查了。我的脚本名为“/home/myid/echo-me.sh”。该脚本所做的只是回显 $1。我工作的最后一步是“成功”。
如果我从命令行运行脚本,它就会起作用。命令:“/home/myid/echo-me.sh helloworld”按照预期生成“helloworld”。然而,Pentaho 似乎通过“/bin/sh”调用脚本,如“/bin/sh/ -c /home/myid/echo-me.sh helloworld”。在这种情况下,该参数不会传递给我的 shell 脚本。我通过像这样从命令行手动运行它来确认这一点。如果我在脚本(和参数)周围加上单引号,如下所示:“/bin/sh/ -c '/home/myid/echo-me.sh helloworld'”,它就可以正常工作。
不幸的是,我不知道如何让 Pentaho 做同样的事情。在“脚本文件名”字段中放置引号会导致各种破坏。
有趣的是,这对于 Windows 来说似乎不是问题。它似乎正确地转义了 shell 字符串...如下所示:
cmd.exe /C ""c:\mytest\echo-me.bat" helloworld"
谁能告诉我我做错了什么吗?解决办法吗?
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
叹息......所以我们显然有一个 Pentaho 的定制版本,一些白痴超越了这里的逻辑并破坏了它。一旦我恢复到核心,一切都很好。感谢您的任何考虑。
sigh... so we apparently have a customized version of Pentaho, and some idiot overrode the logic here and broke it. Once I reverted to core, all works great. Thanks for any consideration.