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

Peter McNabb peter at mcnabbs.org
Thu Dec 6 13:32:42 MST 2007

On Dec 6, 2007, at 12:59 PM, Michael L Torrie wrote:

> 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.

I've wished on many occasions that 'ls' had this as an option. 'ls -- 
fullpath filename' would be a common thing to do if it was available.  
It's nice to know about readlink though. Thanks, Byron (and Michael  
for asking).

More information about the PLUG mailing list