How can i pass String parameter with a space in the command line?

One Star

How can i pass String parameter with a space in the command line?

Hello, i 'm trying to pass context parameter in command line.
MyJob_run.sh --context_param mail_title="Report of last month" --context_param mail_msg="Find attached the reports"

What i end up getting in the mail is a mail with the Title: "Report" and the Message "Find".
I've tried using simple quote, backslash etc... no luck.

It seems the shell doesnt care there are quote and consider that after the space it s a new argument.

I'll be grateful for any pointers.
One Star

Re: How can i pass String parameter with a space in the command line?

If you look within the shell script (MyJob_run.sh in your case) I believe you will see something like,

java <options> $*

where the "$*" obviously is going to take whatever you passed on the command line [to MyJob_run.sh] and "passes it on" to the java command. I think the issue you're running into is due to the way "$*" takes what you're providing and turns it around to the java command. For instance, I don't see any quotes (") around the $* so the spaces probably cause issues right there. I would experiment with invoking the java command directly to see if you can pass the title and message that you want first that way and then proceed from there. Hope this helps.
Shoot for the stars. You'll at least hit the ceiling. ;-)
One Star

Re: How can i pass String parameter with a space in the command line?

This looks like a bug in Talend. In the .sh script generated by Talend, I believe the final clause should be "$@" (including the quotes) rather than $*. The "$@" notation causes the parameters to be passed separately rather than as one long string separated by spaces.

Happy to be corrected on this.
Seventeen Stars

Re: How can i pass String parameter with a space in the command line?

hi all,

any problem with 5.1.1 and generated syntax and result (using simple tJava System.out)

regards
laurent
One Star

Re: How can i pass String parameter with a space in the command line?

Hi,

This is a known bug that should be fixed.

See jira issue: https://jira.talendforge.org/browse/TDI-20228

Regards,
Arno

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Have you checked out Talend’s 2019 Summer release yet?

Find out about Talend's 2019 Summer release

Blog

Talend Summer 2019 – What’s New?

Talend continues to revolutionize how businesses leverage speed and manage scale

Watch Now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog