I feel stupid -- determine the full path to a file
Michael L Torrie
torriem at chem.byu.edu
Thu Dec 6 13:13:27 MST 2007
Shane Hathaway wrote:
> Michael L Torrie wrote:
>> My solution, thanks to Byron clark is:
>> abspath=$( readlink -f $fn )
>> readlink is part of the standard GNU coreutils.
> That's clearly the best answer, aside from Jonathan's sound
> recommendation to write the script in Python instead. :-)
Python is my favorite general-purpose language. But python makes a
really poor shell scripting language. There are no easy means in Python
of working down at the low level of files and pipes between things.
There have been some hacks I've seen to emulate the functionality in
python. Things like:
Bash is just wonderful at putting existing tools together using
processes and pipes. While I could do everything in Python in this
case, bash is the more comfortable language for doing this kind of
thing. Especially since in my script, most of what I need to do is run
other commands, like, fdisk, fsck, mount, and so forth.
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
More information about the PLUG