user3797729
user3797729

Reputation: 87

how to Execute multiple shell commands in tsystem component talend

My Talend open Studio For Data Integreation version 6.0 And Platform Cent OS 6.5

I was trying to execute multiple shell commands in tsystem component

"cp -f -v dir1 dir2 ; cp -f -v dir3 dir4"

I was getting error

cp: cannot stat `;': No such file or directory

In windows Enironment I tried and it was fine.

"cmd /c xcopy "c:/folder1" "d:/folder2" /y /f /I & xcopy "c:/folder3" "d:/folder4" /y /f /I"

Could you guid me in this.

Upvotes: 0

Views: 6119

Answers (1)

54l3d
54l3d

Reputation: 3973

For linux env you can use this:

new String[] {"/bin/bash","-c","cp -f -v dir1 dir2 ","cp -f -v dir3 dir4"}

or choose the array command in the tSystem component, and put each element of the previous array in a separated line. If this not work, you can use tForEach before tSystem to iterate over many commands that are stored in the tForEach component:

tForEach-----(iterate)-------tSystem---..

Upvotes: 1

Related Questions