Hi,
I have script which should set path(environment) variable dynamically.
If prj=dev then
$path=...
else
$path=....
Please let me know how to go about this.Thanks.
Dynamically Setting Environment variables
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The actual syntax will depend on which shell you are scripting for. Typically there's a statement that marks the end of the IF block.
Beware of using shell variable names that might be confused with environment variable names such as PATH.
Code: Select all
if [ $prj -eq 'dev' ]
$path=/dev/pathname
else
$path=/tst/pathname
fi
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 612
- Joined: Thu May 03, 2007 4:59 am
- Location: Melbourne
You are invited to consider this also: Using C/C++ API (DataStage development kit) build a self-contained program to change the Environment variables.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
WHERE inside DataStage? Usually the method for a job is to set up a job parameter that references the environment variable; you can make reference to that job parameter wherever it is appropriate to do so within the job.
Or in a job sequence you can do the same, or you can load the value into a user variable using a User Variables activity.
Or in a job sequence you can do the same, or you can load the value into a user variable using a User Variables activity.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: