<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BigSmoke &#187; script</title>
	<atom:link href="http://blog.bigsmoke.us/tag/script/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.bigsmoke.us</link>
	<description>Smokes your problems, coughs fresh air.</description>
	<lastBuildDate>Sat, 04 Feb 2012 18:03:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Microsoft batch file meets bash shellscript</title>
		<link>http://blog.bigsmoke.us/2007/06/11/microsoft-batch-file-meets-bash-shellscript</link>
		<comments>http://blog.bigsmoke.us/2007/06/11/microsoft-batch-file-meets-bash-shellscript#comments</comments>
		<pubDate>Mon, 11 Jun 2007 19:41:22 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[polyglot]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/2007/06/11/microsoft-batch-file-meets-bash-shellscript</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>Luca City, who already shared a nice <a href="http://blog.bigsmoke.us/2007/05/09/bypassing-smart-completion-in-bash">readline keyboard shortcut</a> with me, wrote me again on May 14 to share another unrelated, but very interesting trick:</p>

<blockquote><p>Hi Rowan,<br />
as you are interested in tricks and curiosities, I send you a thing.<br />
I wanted a script to be runnable from both windows and linux and I found out a way to do it.
Generally you can have two different files, one for each OS, but I started with this goal in mind and then it became a challenge. After trying a bit, playing with the strangest tricks of the two batch languages (bat and bash), I ended up with this solution.
Actually it is not so useful <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  but anyway&#8230;</p></blockquote>

<p>Well Luca, regardless of the usefulness of your script, I happen to think that it&#8217;s pure genius, so I&#8217;m going to share it here:</p>

<pre class="bash"><span style="color: #000066;">echo</span> off
<span style="color: #000066;">echo</span> ; <span style="color: #000066;">set</span> +v <span style="color: #808080; font-style: italic;"># &gt; NUL</span>
<span style="color: #000066;">echo</span> ; <span style="color: #b1b100;">function</span> GOTO <span style="color: #66cc66;">&#123;</span> true; <span style="color: #66cc66;">&#125;</span> <span style="color: #808080; font-style: italic;"># &gt; NUL</span>
&nbsp;
GOTO WIN
<span style="color: #808080; font-style: italic;"># bash part, replace it to suit your needs</span>
<span style="color: #000066;">exit</span> <span style="color: #cc66cc;">0</span>
&nbsp;
:WIN
REM win part, replace it to suit your needs</pre>

<p>Give the script a <tt>.bat</tt> extension for Windows and set the executable bit(s) for Unix.</p>

<p>Thanks, Luca, for sharing another nice trick with us.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2007/06/11/microsoft-batch-file-meets-bash-shellscript/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

