Hi all,
I am having a unix script which is getting called by a before/after subroutine.The script is just searching for a file like
find home/md/DEV/MIS/LANDING -name MIS_Customer_\*.
But i dont want to hardcode the path in my script.But am having an environment varibale defined in my administartor as
PATH(ie)home/md/DEV/MIS/LANDING .Is there any way to access that environment variable in my shell script ??.or please let me know anyother workaround to achive this.
Please help me
regards,
rajarp
acessing environment variable in scripts
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Pass the value of the environment variable as a command line argument when invoking the script, and pick it up within the script as a shell variable that reads the command line, for example $1.
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:
That would fail if the job parameter had been given a non-default value at run time, which does not change the environment variable value. That's why I thought the indirection was necessary.chulett wrote:Or seems to me you could just reference it directly in the script - $VariableName or ${VariableName} for example.
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.
Actually, if you've added an Environment Variable as a job parameter and assigned it a non-default value at runtime, then it *is* changed for the duration of the session. So I don't really think it would fail.
Simple enough to test if one felt the urge.
Simple enough to test if one felt the urge.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers