Shell Script Execution on Linux

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
Amin
Premium Member
Premium Member
Posts: 27
Joined: Fri Oct 24, 2014 10:02 am

Shell Script Execution on Linux

Post by Amin »

We have a shell script that runs on Windows and we want to run that file in Linux through DataStage.

File contents are as;
param(
[string]$sourcepath,
[string]$targetpath
)

$OWlogtext = "`nStarted at " + (Get-Date).ToString()
$CommandName = $MyInvocation.MyCommand.Name
$OWlogfilename = $CommandName -replace '.ps1', '.txt'
$OWlogpath = "E:\Overwatch\logs\$OWlogfilename"
$OWlogtext>>$OWlogpath
Write-Output "Sourcepath is $sourcepath" >>$OWlogpath
Write-Output "Targetpath is $targetpath" >>$OWlogpath

$filetext = [System.IO.File]::ReadAllLines($sourcepath)
$filetext = $filetext -replace '\x22', ''
[System.IO.File]::WriteAllLines($targetpath, $filetext)>>$null
Now my questions are;
1: When the script runs on Linux are any changes required?
2: How to run Script in DataStage? There is a routine namecalled ExeShell but never understand that.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

1. Typically only the pathnames.
2. Execute Command stage in a Sequence or ExecSH before/after job.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Amin
Premium Member
Premium Member
Posts: 27
Joined: Fri Oct 24, 2014 10:02 am

Post by Amin »

Please can you explain in detail...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sorry but not sure what kind of detail you might be after. If you have some additional specific questions, please ask them.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply