Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
VChauhan1611936886
Contributor II
Contributor II

Unable to execute a shell script with context variables as parameters

I am trying to run a Talend job to call a unix shell script using tsystem , but I noticed that the parameters I am passing while calling the shell script is not getting passed to script.

I tried multiple ways but could not find a way to achieve this

Following is the command I used :

"sudo su - talend_user -c myscript.sh "+context.param1+" "+context.param2+" "+context.param3

Labels (3)
6 Replies
Anonymous
Not applicable

Hi

Is myscript.sh a job script? Please try:

"sudo su - talend_user -c myscript.sh --context=Default --context_param varName1="+context.varName1

 

Regards

Shong

Raghuram_Puram
Contributor III
Contributor III

Hi @Shicong Hong​ 

 

  1. Will this cause a problem if context.param2 is an Integer?
  2. How to pass multiple arguments, "sudo su - talend_user -c myscript.sh --context=Default --context_param varName1="+context.varName1+" --context_param varName2="+context.varName2

Like this? Please note the space after Name1+"

 

Regards,

Raghu

 

VChauhan1611936886
Contributor II
Contributor II
Author

@Shong .. This is a unix shell script whicj is trying to perform some operations on files.

VChauhan1611936886
Contributor II
Contributor II
Author

@Shicong Hong​  I tried following approach, it does not seems to be working :-

"sudo su - talend_user -c myscript.sh --context=Default --context_param param1="+context.param1+" --context_param param2="+context.param2+" --context_param param3="+context.param3+" --context_param param4="+context.param4

 

I also tried an alternative approach :-

"sudo su - talend_user -c myscript.sh param1="+context.param1+" param2="+context.param2+" param3="+context.param3+" param4="+context.param4

 

I don't see parameters getting passed to my unix shell script

 

 

Anonymous
Not applicable

Hi

The -context_param is used to pass value to context variables when executing the Talend job script out of studio, if myscript.sh is a common unix shell script, please google it on internet, eg:

https://unix.stackexchange.com/questions/31414/how-can-i-pass-a-command-line-argument-into-a-shell-script

https://unix.stackexchange.com/questions/372713/how-can-i-pass-variable-in-script-via-terminal-when-execute-abc-sh

 

Regards

Shong

 

VChauhan1611936886
Contributor II
Contributor II
Author

I tried to search lots of options to run a script from talend and looks to me that although talend facilitates running script but does not support passing parameters to the unix shell script.