Chris's Wiki :: blog/unix/PortableShThreeUnixes Commentshttps://utcc.utoronto.ca/~cks/space/blog/unix/PortableShThreeUnixes?atomcommentsDWiki2011-03-03T22:28:46ZRecent comments in Chris's Wiki :: blog/unix/PortableShThreeUnixes.From 70.31.31.146 on /blog/unix/PortableShThreeUnixestag:CSpace:blog/unix/PortableShThreeUnixes:294f47cd7a953512648ca879f8bf612187ac78d3From 70.31.31.146<div class="wikitext"><p>If you have bash-isms, and don't want/have time to fix the script, then changing the shebang to "/usr/bin/env bash" is a quick win.</p>
<p>The following utility may also be of some use of you want to do a large-scale migration:</p>
<pre>
http://sourceforge.net/projects/checkbaskisms/
</pre>
<p>Debian (and Ubuntu) have started use dash as /bin/sh I believe, and that caused a bit of breakage. Hopefully more Linux distros will do this--each one ideally using a different sh-equivlant--so that it keeps everyone honest in their coding practices.</p>
</div>2011-03-03T22:28:46ZFrom 76.113.53.175 on /blog/unix/PortableShThreeUnixestag:CSpace:blog/unix/PortableShThreeUnixes:52d525d641f5e85d0d0ed957b09e3ce60f39c3fdFrom 76.113.53.175<div class="wikitext"><p>The GNU solution to this is what one can expect... They have a ridiculously tricky script in gnulib, called init.sh, which "portable" scripts are supposed to source. Then, init.sh searches for a POSIX shell, and if it finds one, re-executes the sourcing script. They claim to find a way to portably determine the path to the sourcing script so that it can be executed etc. The tradeoff is that init.sh is incomprehensive to anyone except possibly Jim M., but the portable caller only needs to use !#/bin/sh, then add one line of " . init.sh" and proceed full POSIX from that line down with all the crazy encapsulated away.</p>
</div>2011-03-03T07:39:24Z