I feel stupid -- determine the full path to a file

Michael L Torrie torriem at chem.byu.edu
Thu Dec 6 12:59:01 MST 2007


Andrew McNabb wrote:
> On Thu, Dec 06, 2007 at 12:47:32PM -0700, Shane Hathaway wrote:
>> abspath=$(cd $(dirname $fn); pwd)/$(basename $fn)
> 
> Okay.  Yours it better than mine. :)

Wow.  Awesome.  Bash is just one giant hack, isn't it.

My solution, thanks to Byron clark is:

abspath=$( readlink -f $fn )

readlink is part of the standard GNU coreutils.

> 
> 


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771




More information about the PLUG mailing list