Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

get script's directory location ala $0

Posted on 2006-06-09
2
Medium Priority
?
356 Views
Last Modified: 2008-03-10

If $0 gives the location of the script, how can I get the directory the script is located?

CWD; doesn't work the I want, since if I execute a script located on a network drive from the commandline on my local PC, the working directory would be whatever directory I'm in at my shell.


0
Comment
Question by:Marketing_Insists
2 Comments
 
LVL 23

Accepted Solution

by:
brettmjohnson earned 1200 total points
ID: 16872385
use the dirname command:
 dirname $0

0
 

Author Comment

by:Marketing_Insists
ID: 16874553
Sorry, somehow posted to wrong group :)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question