I think you meant &quot;$@&quot; rather than $*<p>(The quotes in &quot;$@&quot; are important.)<p>Also, your script will fall over if any of the paths have spaces in them, such as INSTALLDIR.<p>You should use lowercase for variable names like SCRIPT_PATH. Uppercase is for exported variables.<p>readlink -f $0 breaks on OS X. You must do both readlink -f $0 and readlink $0 in order for it to work everywhere.<p>Shell scripting isn&#x27;t easy. It took a year to understand these nuances to the point that they&#x27;re second-nature, and I&#x27;m still discovering new ones. Anything that improves this situation would be a welcome change in my opinion.<p>EDIT: cat&lt;&lt;&#x27;EOF&#x27; is necessary here. cat&lt;&lt;&quot;EOF&quot; will interpolate variables.