relative to absolute path
how to get the absolute path from relative path in shell script? is there any other command and function than pwd.?
thanks in advance |
hi,
I dont think its possible to get absolute path from relative path as the same name of file may exist to any other location so you will get all those entries of given relative path of filename. |
Quote:
Debian comes with a shell utility called "realpath", but it's not installed by default, and not all distributions provide it. The program "realpath" also resolves "..", "." and symbolic links to get the one-and-only full path. If you really need to, such program is quite easy to make, because there is a "realpath()" C-function in the standard C-library. See "man 3 realpath". |
hi Hko,
oh i was not knowing this thing. Thanks for the info |
try this,
Code:
p="../../dirname/filename.bin" |
All times are GMT -5. The time now is 10:57 AM. |