|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to convert relative path to absolute path?
Hello Everyone,
I want to convert Relative Path - /home/stevin/data/APP_SERVICE/../datafile.txt to Absolute Path - /home/stevin/data/datafile.txt Is there a built-in tool in Unix to do this or any good ideas as to how can I implement this. -Steve |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
What OS?
|
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
Generic method: Code:
( cd path; pwd ) |
|
#4
|
|||
|
|||
|
Scrutinizer: I don't think I follow your code. Can you please elaborate.
Radoulov: I am using Linux 2.6.18-194.el5 |
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
Code:
readlink -f /home/stevin/data/APP_SERVICE/../datafile.txt There is an utility called realpath too. |
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
Quote:
Code:
( cd /home/stevin/data/APP_SERVICE/../datafile.txt; pwd ) It is a generic method that should work on most Unix platforms.. |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to change Absolute path to Relative path | sahil_jammu | Shell Programming and Scripting | 4 | 05-31-2011 10:29 AM |
| absolute path for a script ran with relative path | rss67 | Shell Programming and Scripting | 10 | 04-13-2010 07:48 AM |
| Help with absolute path and relative path | mzero | UNIX for Dummies Questions & Answers | 1 | 03-02-2009 09:29 AM |
| $PWD shows absolute path vs path w/symbolic links | kornshellmaven | Shell Programming and Scripting | 3 | 06-13-2007 12:15 PM |
| vi - replacing a relative path with absolute path in a file | Yinzer955i | UNIX for Dummies Questions & Answers | 2 | 09-07-2006 11:47 AM |
|
|