Hitachi Vantara Pentaho Community Forums
Results 1 to 9 of 9

Thread: Passing Arguments to SHELL

  1. #1
    Join Date
    Sep 2007
    Posts
    9

    Smile Passing Arguments to SHELL

    Hi,

    I am currently using the shell in the kettle job. The transformation gets the file names, i am then passing only one file name to the job using set varrable. This variable i want to pass to the shell command to process the file and remove certain charaters.

    The Transformation gets the file names, sets the first file to the variable ${FILENAME} and passes it to the root job. The Shell command in the job takes the shell file name and should pass the variable to the shell command. This is where it breaks and does not want to pass the file name.

    Please could you help me to correct the issue.

    Regards

    Setul Dhanani
    Attached Files Attached Files

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    Since you only have 1 .ktr... you can't set and use a variable in the same ktr.

    Regards,
    Sven

  3. #3
    Join Date
    Sep 2007
    Posts
    9

    Smile Passing the value

    Hi,

    Thanks for the reply.

    The one ktr is getting the file name with the path. I want to pass this to the shell command in the job. this shell command requires the value passed to it.

    This is a small part of a big job i just put in the component that requires this small requirement.

    Regards

    Setul

  4. #4
    Join Date
    May 2006
    Posts
    4,882

    Default

    Problem is that the command line arguments to shell are not yet variable sensitive, so you need a change tracker for that. In v3 you could just use the variables defined with "set variable" as real variables inside of the executed script.

    Regards,
    Sven

  5. #5
    Join Date
    Jul 2007
    Posts
    247

    Default

    The only workaround IMHO at the moment is...

    Design a transformation that gets the filename, store it in a field and copy the results to the parent job. I assume that you need only one row for that. You could even use the get variables step in this transformation to get the filename from a variable.

    In the parent job, use the shell script job entry and activate "copy previous results to args". Your results of the previous transformation will now be used as arguments for the shell script.

    Worked fine for me.


    Regards,
    Ben

  6. #6
    Join Date
    May 2006
    Posts
    4,882

    Default

    Yep that would do it... In the meantime 2.5.2 and 3.0.0-RC1 will support variable-sensitive arguments in shell job entry.

    Regards,
    Sven

  7. #7
    Join Date
    Sep 2007
    Posts
    9

    Smile THanks

    Hi Thanks for all the help i have gone done the route of passing the results to the parent job and then picking up the argument i require.

    All the best with the great work.

    Really like this product.

    One more thing how do a close this ticket ?

    Setul

  8. #8
    Join Date
    May 2006
    Posts
    4,882

    Default

    This thread doesn't require closing, it's a forum.

    This one http://jira.pentaho.org/browse/PDI-189 I "closed"

    Regards,
    Sven

  9. #9
    Join Date
    May 2006
    Posts
    4,882

    Default

    Thanks, note that 2.5.2 and 3.0 will support variables in arguments to shell job entry.

    This thread doesn't require closing, it's a forum.

    This one http://jira.pentaho.org/browse/PDI-189 I "closed"

    Regards,
    Sven

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.