Page 1 of 1

DSExecute and cd on unix

Posted: Tue Nov 08, 2005 10:17 am
by koojo
The cd commond does not seem to be effective when I use it.

When i do a pwd it shows the projects directory.

Is there any way I can cd to a given directory and then use unix commands (by using DSExecute) on files in a different path.

Posted: Tue Nov 08, 2005 10:38 am
by ArndW
Hello Koojo,

the DSExecute() command will open up a command shell in the current working directory (the project in which your DataStage job is running). Once the command returns back to the DataStage job this shell is closed; so doing a DSExecute() to cd to another directory and then using another DSExecute() will give you the current project directory as the attach point. If you need to execute a series of commands then call up a script from DataStage which then does your other commands.

Posted: Tue Nov 08, 2005 10:44 am
by chulett
You can string a series of commands together using a semi-colon as a separator. This is normal UNIX stuff.

Code: Select all

cd /x/y/z; cat dddd
Etc, etc. Works just fine like this in DSExecute or ExecSH.

Posted: Tue Nov 08, 2005 10:48 am
by kcbland
or just fully qualify everything

Posted: Tue Nov 08, 2005 11:54 am
by koojo
Thank you guys.

kcbland,
I am quiet comfortable with basic and not quiet comfortable working with unix.

I was wondering what you mean by fully qualify everything.

Posted: Tue Nov 08, 2005 11:58 am
by kcbland
Instead of:

Code: Select all

cd /here/there/everywhere/scripts
./runmyscript.ksh
You should just do

Code: Select all

/here/there/everywhere/scripts/runmyscript.ksh
You should write scripts that can be executed from anywhere and have enough logic to handle not requiring a directory change. Beginner programmers do this, rather than fully qualify all paths. It's rather elegant to set variables to hold directory paths within your script and then just use that variable when constructing a filename.

Posted: Tue Nov 08, 2005 12:01 pm
by koojo
Thank you,

You guys are faster than other support available.
:lol:

koojo

Posted: Tue Nov 08, 2005 12:04 pm
by kcbland
And free, too.

Posted: Tue Nov 08, 2005 12:05 pm
by ArndW
Don't forget about "more accurate", either 8)

Posted: Tue Nov 08, 2005 12:09 pm
by kcbland
And most of our answers don't end with:
You need to wait for the next version...
Or
You need to upgrade to PX...
Or
You need to get some help from Professional Services...
We help get it done now, rather than later, if ever. 8)