<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Messing up with command-line arguments in Bash: $*, $@, &quot;$*&quot;, &quot;$@&quot;,&#8230;</title>
	<atom:link href="http://tadek.pietraszek.org/blog/2006/01/05/messing-up-with-command-line-arguments-in-bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://tadek.pietraszek.org/blog/2006/01/05/messing-up-with-command-line-arguments-in-bash/</link>
	<description>Some random notes about computers, security, cool links and others.</description>
	<lastBuildDate>Thu, 15 Jul 2010 15:44:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: lowrykun</title>
		<link>http://tadek.pietraszek.org/blog/2006/01/05/messing-up-with-command-line-arguments-in-bash/comment-page-1/#comment-37322</link>
		<dc:creator>lowrykun</dc:creator>
		<pubDate>Fri, 28 Aug 2009 22:13:55 +0000</pubDate>
		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/?p=230#comment-37322</guid>
		<description>&lt;p&gt;Dude - it&#039;s 2009 and this page is still dolling out love!&lt;/p&gt;

&lt;p&gt;Thanks for the tip!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Dude &#8211; it&#8217;s 2009 and this page is still dolling out love!</p>

<p>Thanks for the tip!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Mac</title>
		<link>http://tadek.pietraszek.org/blog/2006/01/05/messing-up-with-command-line-arguments-in-bash/comment-page-1/#comment-36616</link>
		<dc:creator>Mac</dc:creator>
		<pubDate>Mon, 28 Jul 2008 11:22:04 +0000</pubDate>
		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/?p=230#comment-36616</guid>
		<description>&lt;p&gt;I found the problem and the solution after about an hour as well, then discarded the solution because it didn&#039;t look like it was working.  I was using &#039;echo&#039; display the expanded java command and parameters, and it seems that echo strips off quotes, so the output looked the same and I assumed it wasn&#039;t going to work.&lt;/p&gt;

&lt;p&gt;In this example, the command is:&lt;/p&gt;

&lt;p&gt;test.sh -p &quot;a b c&quot;&lt;/p&gt;

&lt;p&gt;echo $JAVA_HOME/bin/java com.example.MyClass &quot;$@&quot; ---? /usr/java/jdk1.5.0_12/bin/java com.example.MyClass -p a b c&lt;/p&gt;

&lt;p&gt;echo $JAVA_HOME/bin/java com.example.MyClass $@ ---&gt; /usr/java/jdk1.5.0_12/bin/java com.example.MyClass -p a b c&lt;/p&gt;

&lt;p&gt;No difference, I thought, so that back to the drawing board.&lt;/p&gt;

&lt;p&gt;BUT, after reading this blog, I tried again and executed with sh -x, I see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;echo /usr/java/jdk1.5.0_12/bin/java com.example.MyClass -p &#039;a b c&#039;
/usr/java/jdk1.5.0_12/bin/java com.example.MyClass -p a b c&lt;/li&gt;
&lt;li&gt;echo /usr/java/jdk1.5.0_12/bin/java com.example.MyClass -p a b c
/usr/java/jdk1.5.0_12/bin/java com.example.MyClass -p a b c&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;doh!&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I found the problem and the solution after about an hour as well, then discarded the solution because it didn&#8217;t look like it was working.  I was using &#8216;echo&#8217; display the expanded java command and parameters, and it seems that echo strips off quotes, so the output looked the same and I assumed it wasn&#8217;t going to work.</p>

<p>In this example, the command is:</p>

<p>test.sh -p &#8220;a b c&#8221;</p>

<p>echo $JAVA_HOME/bin/java com.example.MyClass &#8220;$@&#8221; &#8212;? /usr/java/jdk1.5.0_12/bin/java com.example.MyClass -p a b c</p>

<p>echo $JAVA_HOME/bin/java com.example.MyClass $@ &#8212;&gt; /usr/java/jdk1.5.0_12/bin/java com.example.MyClass -p a b c</p>

<p>No difference, I thought, so that back to the drawing board.</p>

<p>BUT, after reading this blog, I tried again and executed with sh -x, I see:</p>

<ul>
<li>echo /usr/java/jdk1.5.0_12/bin/java com.example.MyClass -p &#8216;a b c&#8217;
/usr/java/jdk1.5.0_12/bin/java com.example.MyClass -p a b c</li>
<li>echo /usr/java/jdk1.5.0_12/bin/java com.example.MyClass -p a b c
/usr/java/jdk1.5.0_12/bin/java com.example.MyClass -p a b c</li>
</ul>

<p>doh!</p>

<p>Thanks!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Roman</title>
		<link>http://tadek.pietraszek.org/blog/2006/01/05/messing-up-with-command-line-arguments-in-bash/comment-page-1/#comment-30125</link>
		<dc:creator>Roman</dc:creator>
		<pubDate>Thu, 17 Jan 2008 20:41:13 +0000</pubDate>
		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/?p=230#comment-30125</guid>
		<description>&lt;p&gt;Excellent. This was very useful. Thanks!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Excellent. This was very useful. Thanks!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://tadek.pietraszek.org/blog/2006/01/05/messing-up-with-command-line-arguments-in-bash/comment-page-1/#comment-14425</link>
		<dc:creator>David</dc:creator>
		<pubDate>Sun, 22 Apr 2007 00:21:17 +0000</pubDate>
		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/?p=230#comment-14425</guid>
		<description>&lt;p&gt;Nice one. If found the problem with $@ quickly but not the solution (actually I first thought there might be a problem with the parsing library). Of course, in hindsight, a peek at the man page would have helped:&lt;/p&gt;

&lt;p&gt;man bash&lt;/p&gt;

&lt;p&gt;...
 @  Expands to the positional parameters, starting from one.  When the expansion occurs within double quotes, each parameter expands to  a  sepa-
     rate  word.  That is, &quot;$@&quot; is equivalent to &quot;$1&quot; &quot;$2&quot; ...  When there are no positional parameters, &quot;$@&quot; and $@ expand to nothing (i.e., they
     are removed).
...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Nice one. If found the problem with $@ quickly but not the solution (actually I first thought there might be a problem with the parsing library). Of course, in hindsight, a peek at the man page would have helped:</p>

<p>man bash</p>

<p>&#8230;
 @  Expands to the positional parameters, starting from one.  When the expansion occurs within double quotes, each parameter expands to  a  sepa-
     rate  word.  That is, &#8220;$@&#8221; is equivalent to &#8220;$1&#8243; &#8220;$2&#8243; &#8230;  When there are no positional parameters, &#8220;$@&#8221; and $@ expand to nothing (i.e., they
     are removed).
&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Rogan Creswick</title>
		<link>http://tadek.pietraszek.org/blog/2006/01/05/messing-up-with-command-line-arguments-in-bash/comment-page-1/#comment-3697</link>
		<dc:creator>Rogan Creswick</dc:creator>
		<pubDate>Mon, 21 Aug 2006 23:06:34 +0000</pubDate>
		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/?p=230#comment-3697</guid>
		<description>&lt;p&gt;ah, you just saved me an hour or more :) Thanks for sharing!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>ah, you just saved me an hour or more <img src='http://tadek.pietraszek.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Thanks for sharing!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Dan White</title>
		<link>http://tadek.pietraszek.org/blog/2006/01/05/messing-up-with-command-line-arguments-in-bash/comment-page-1/#comment-2201</link>
		<dc:creator>Dan White</dc:creator>
		<pubDate>Tue, 20 Jun 2006 19:33:42 +0000</pubDate>
		<guid isPermaLink="false">http://tadek.pietraszek.org/blog/?p=230#comment-2201</guid>
		<description>&lt;p&gt;I just spent an hour trying to figure this out. My problem was that I was using $* instead of $@. Watch out for that!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I just spent an hour trying to figure this out. My problem was that I was using $* instead of $@. Watch out for that!</p>]]></content:encoded>
	</item>
</channel>
</rss>
