Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Pass an environment variable argument to a shell script

  1. #1
    Join Date
    Jun 2007
    Posts
    12

    Default Pass an environment variable argument to a shell script

    I would like to be able to pass an environment variable argument to an 'execute shell script' command in spoon.

    Is this possible? When I try to put in${MYVAR1}, it doesn't translate this to the variable value, but keeps the variable name.


    As a work around, if I try to put the environment variable argument into the "Script File Name" entry box along with the variable name for the script to execute, the additional quotes added by spoon before execution conflict with the successful passing of the variables.


    For example:

    If
    ${PARSER_PROGRAM} = C:\Program Files\DataMystic\TextPipe\textpipe.exe

    and if
    ${P01_PARSER_ARGUMENTS} =
    "/f=C:\FileTransfers\LifeScan-ACG\Code\Parser_TEST.fll"
    (with or without quotes)


    If I put the series of variables into the field like such:
    ${PARSER_PROGRAM} ${P01_PARSER_ARGUMENTS}

    Spoon translates this to the following:

    cmd.exe /C "C:\Program Files\DataMystic\TextPipe\textpipe.exe "\f=C:\FileTransfers\LifeScan-ACG\Code\Parser_TEST.fll""


    Which gives the error " 'C:\Program' is not recognized as an internal or external command,"

    or I try to use prgra~1 instead of Program Files, I get the following...

    Executing command : cmd.exe /C ""C:\progra~1\DataMystic\TextPipe\textpipe.exe \f=C:\FileTransfers\LifeScan-ACG\Code\Parser_TEST.fll""
    2007/08/08 12:10:42 - textpipe execution (stderr) - The filename, directory name, or volume label syntax is incorrect.

    Essentially, Spoon is just putting too many quotes around things that I want to execute... is there either a way to avoid this or pass environment variables as an argument?

  2. #2
    Join Date
    Jun 2007
    Posts
    12

    Default What I want to have happen.

    I forgot to lay out what I would essentially want to have execute if everything worked perfectly


    cmd.exe /C "C:\progra~1\DataMystic\TextPipe\textpipe.exe /f=C:\FileTransfers\LifeScan-ACG\Code\Parser_TEST.fll /g /q"


    that is the goal. Progra~1 or Program Files, I don't care... but I would like the paths to the executable and to the file to be environment variables.

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

    Default

    in v3.0 you can use environment variables to pass stuff to a batch script. The spaces, I don't know right now. Other steps have similar problems with spaces.

    What I take as rule is not to include any spaces in any of my paths, so I never have the problem you have.

    Regards,
    Sven
    Last edited by sboden; 08-08-2007 at 04:10 PM.

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.