Hi again,
I saw you committed this - thanks a lot :)
Kind regards,
Ralf
On Sunday 06 November 2011 22:23:03 Dimitar Popov wrote:
> Am Sonntag, 6. November 2011, 21:26:03 schrieb Ralf Jung:
> > Hi,
> >
> > this will break if the link is absolute, since it will still prepend the
> > $(dirname "$FILE") to the value we got from readlink. So if I call
> > /home/r/bin/basexhttp, which is a link to
> > /home/r/bin/basex/bin/basexhttp, it will set FILE to
> > /home/r/bin//home/r/bin/basex/bin/basexhttp.
>
> Yes, I saw that, but a second after I sent the email :)
>
> > Also, I wonder why you are splitting $SOURCE into basename and dirname,
> > just to concat it again?
>
> Yep, that was not necessary. Here is a version, which I hope works
> correctly:
>
> FILE="${BASH_SOURCE[0]}"
> while [ -h "$FILE" ] ; do
> SOURCE="$(readlink "$FILE")"
> FILE="$( cd -P "$(dirname "$FILE")" && \
> cd -P "$(dirname "$SOURCE")" && pwd )/$(basename "$SOURCE")"
> done
> BASEX_DIR="$( cd -P "$(dirname $FILE)" && pwd )"
>
> Dimitar