Am 11.06.2012 11:48, schrieb Hussein Shafie:
> On 06/10/2012 08:34 PM, Piotr Minkina wrote:
>> Hmmm, You're right... readlink may be not available in MacOS.
>>
>
> A colleague of mine found this which should work fine on most Unix systems:
>
> ---
> if [ -L "$0" ]; then
> # Ugly but should work on most systems.
> scriptFile=`ls -l "$0" | awk '{print $(NF)}'`
> else
> scriptFile="$0"
> fi
>
> dist=`dirname "$scriptFile"`
> ---
This unfortunately doesn't work when the symlink's target is given as a
relative path. A more universally usable solution could thus be:
--
if [ -L "$0" ]; then
# Ugly but should work on most systems.
scriptFileLinkSourceDir=`ls -l "$0" | awk '{print $(8)}' | awk {'
sub("/[^/]+$",""); print $1 '}`
scriptFileLinkTarget=`ls -l "$0" | awk '{print $(NF)}'`
scriptFile=$scriptFileLinkSourceDir/$scriptFileLinkTarget
else
scriptFile="$0"
fi
dist=`dirname "$scriptFile"`
--
Awk experts out there: Feel free to optimize this ugly code.
Hussein: As soon as you judge the modified startup script code acceptable, it
would be great to have it included in one of the next XXE releases, because
this would spare Unix/Linux users from having to modify the start script by
hand each time when installing XXE (once they use a symlink).
Yves
--
Dr. Yves Forkl - Softwareentwicklung
SRZ, Bessemerstr. 83-91, 12103 Berlin
www.srz.de | Firmengruppe: www.besscom.de
tel +49 30 75301-335 | fax +49 30 75301-11335
Satz-Rechen-Zentrum Hartmann+Heenemann GmbH&Co. KG
Sitz Berlin | AG Charlottenburg | HRA 8089
Komplementärin Satz-Rechner-Betriebsgesellschaft mbH
Sitz Berlin | AG Charlottenburg | HRB 4905
Geschäftsführer: Walter Fock
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support