Which script am I actually running - TechRepublic
General discussion
April 19, 2006 at 08:11 AM
sdlewis

Which script am I actually running

by sdlewis . Updated 20 years, 1 month ago

I need a UNIX command that when called from a script will allow me to know which directory the script is being run from. Our versioning for production and test is simply to use different directory path. If I use which, it will simply tell me which one is in my path first. Right now I use pwd. The problem with pwd is that it will only tell me where it was called from. I want the script to be able to be called from anywhere. I have tried to compensate for that by checking $0 as well, but that will backfire if someone calls the test script from the production path. This is a ksh script.

This discussion is locked

All Comments