On Mon, Mar 15, 2004 at 10:31:45PM +1100, Ken Foskey wrote:
> I have a configure problem for OOo. /usr/bin/ant is a link to
> /usr/share/ant/bin/ant. I need to find the ultimate source for that
> link so that the ANT_HOME directory is set correctly.
Does that really matter? Usually the link /usr/bin/ant would
work just fine. I'd be interested to know what breaks.
> Is there an easy cross platform way to do that?
There is a 'realpath' routine in the Unix standard library.
On Solaris there is a realpath command which invokes it.
Linux has the realpath routine, but this fedora I'm using
doesn't have the command.
The command is trivial, so you could distribute with OOo
if you like.
AH .... just reading the man page: there is an admonishment
not to use because of a silly API. Linux says to use readlink
instead.
So: (untested)
link=/where/ever/you/want
if realname=`readlink -f "$link"' || realname=`realpath "$link"`
then
echo "real name is \"$realname\" "
else
echo >&2 "real name could not be determined"
exit 1
fi
Matt
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html