Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

finding the directory of a file

Status
Not open for further replies.

mdraja

Programmer
Oct 14, 2003
44
GB
Hi

Is there a way of outputting the directory of a file? Therefore, if I wanted to find out the directory of ../../test.sh, how could I get its directory without actually cd'ing to that directory and typing pwd?
 
I can get find to display the location of the file from my current directory, but how can I display the full path of the file?
 
If you want the ABSOLUTE path, you can:

DIR=$(cd $(dirname $F); pwd -P)

$(...) works in ksh (enhanced `...`)

Theophilos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top