Re: Finding an absolute pathname



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
.