Re: Finding an absolute pathname
- From: Liam O'Toole <liam.p.otoole@xxxxxxxxx>
- Date: Wed, 28 Feb 2007 14:30:24 GMT
On Wed, 28 Feb 2007 12:31:17 GMT
Colin Brough <Colin.Brough@xxxxxxxxxxxxxxxxxx> wrote:
Given a file argument is there a quick way to translate it into an
absolute path? I can do it for a file in the current directory or one
that is already an absolute filename - but not for a relative path...
So, help me write:
function fullpath () {
# What goes here?
}
So that:
cmb > pwd
/home/cmb
cmb > fullpath file
/home/cmb/file
cmb > fullpath tmp/file
/home/cmb/tmp/file
cmb > cd bar
cmb > fullpath ~/tmp/file
/home/cmb/tmp/file
cmb > fullpath ../tmp/file
/home/cmb/tmp/file
Cheers
Colin
Use 'readlink -f' (part of GNU coreutils).
--
Liam
.
- Follow-Ups:
- Re: Finding an absolute pathname
- From: Andy Burns
- Re: Finding an absolute pathname
- References:
- Finding an absolute pathname
- From: Colin Brough
- Finding an absolute pathname
- Prev by Date: Re: Finding an absolute pathname
- Next by Date: Re: Finding an absolute pathname
- Previous by thread: Re: Finding an absolute pathname
- Next by thread: Re: Finding an absolute pathname
- Index(es):