<div>Hi.</div><div>I am not a bash expert, I just want to share how to follow symbolic links I&#39;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 &quot;$(dirname &quot;$0&quot;)&quot; ; pwd)<br>
<br># Was this invoked as a link ?<br>if [ -L &quot;$0&quot; ]<br>then<br>            LINKTO=$(/usr/bin/readlink &quot;$0&quot;)<br><br>            # Is the link a relative path<br>            if [[ &quot;${LINKTO}&quot; = /* ]]<br>
            then<br>                    # absolute path so just invoke it<br>                 exec &quot;${LINKTO}&quot; &quot;$@&quot;<br>            else<br>                    # invoke by prepending our folder<br>                 exec &quot;${SELF_LOCATION}/${LINKTO}&quot; &quot;$@&quot;<br>
     fi<br>fi<br><br># Run IDE<br>&quot;${SELF_LOCATION}/AptanaStudio3&quot; -application com.aptana.commandline.launcher.LauncherApplication &quot;$@&quot; &gt; /dev/null 2&gt;&amp;1 &amp;<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">&lt;<a href="mailto:merlyn@stonehenge.com">merlyn@stonehenge.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
&gt;&gt;&gt;&gt;&gt; &quot;Sven&quot; == Sven Van Caekenberghe &lt;<a href="mailto:sven@beta9.be">sven@beta9.be</a>&gt; writes:<br>
<br>
Sven&gt; $(readlink -f $(dirname $0))<br>
<br>
readlink -f is a GNU-ism, apparently.  And since OSX isn&#39;t GNU (it&#39;s<br>
mostly FreeBSD userland), not surprising it breaks.<br>
<br>
Sven&gt; seems to be a trick to get at the absolute directory path the<br>
Sven&gt; current script is in and it does not seem to work on Mac OS X, we<br>
Sven&gt; always use<br>
<br>
Sven&gt; MY_HOME=$(dirname $0)<br>
Sven&gt; MY_HOME=$(cd $MY_HOME &amp;&amp; pwd)<br>
<font color="#888888"><br>
--<br>
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095<br>
&lt;<a href="mailto:merlyn@stonehenge.com">merlyn@stonehenge.com</a>&gt; &lt;URL:<a href="http://www.stonehenge.com/merlyn/" target="_blank">http://www.stonehenge.com/merlyn/</a>&gt;<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>