<div>Hi.</div><div>I am not a bash expert, I just want to share how to follow symbolic links I've seen in a script:</div><div><br></div><div><br></div><div>#!/usr/bin/env bash<br># Find our location<br>SELF_LOCATION=$(cd "$(dirname "$0")" ; pwd)<br>
<br># Was this invoked as a link ?<br>if [ -L "$0" ]<br>then<br> LINKTO=$(/usr/bin/readlink "$0")<br><br> # Is the link a relative path<br> if [[ "${LINKTO}" = /* ]]<br>
then<br> # absolute path so just invoke it<br>          exec "${LINKTO}" "$@"<br> else<br> # invoke by prepending our folder<br>          exec "${SELF_LOCATION}/${LINKTO}" "$@"<br>
fi<br>fi<br><br># Run IDE<br>"${SELF_LOCATION}/AptanaStudio3" -application com.aptana.commandline.launcher.LauncherApplication "$@" > /dev/null 2>&1 &<br><br># Detach it<br>disown -h %-<br>
disown %-</div><div><br></div><div><br></div><br><div class="gmail_quote">2011/4/19 Randal L. Schwartz <span dir="ltr"><<a href="mailto:merlyn@stonehenge.com">merlyn@stonehenge.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
>>>>> "Sven" == Sven Van Caekenberghe <<a href="mailto:sven@beta9.be">sven@beta9.be</a>> writes:<br>
<br>
Sven> $(readlink -f $(dirname $0))<br>
<br>
readlink -f is a GNU-ism, apparently. And since OSX isn't GNU (it's<br>
mostly FreeBSD userland), not surprising it breaks.<br>
<br>
Sven> seems to be a trick to get at the absolute directory path the<br>
Sven> current script is in and it does not seem to work on Mac OS X, we<br>
Sven> always use<br>
<br>
Sven> MY_HOME=$(dirname $0)<br>
Sven> MY_HOME=$(cd $MY_HOME && pwd)<br>
<font color="#888888"><br>
--<br>
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095<br>
<<a href="mailto:merlyn@stonehenge.com">merlyn@stonehenge.com</a>> <URL:<a href="http://www.stonehenge.com/merlyn/" target="_blank">http://www.stonehenge.com/merlyn/</a>><br>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.<br>
See <a href="http://methodsandmessages.posterous.com/" target="_blank">http://methodsandmessages.posterous.com/</a> for Smalltalk discussion<br>
</font><div><div class="h5">_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</div></div></blockquote></div><br>