<?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: shell脚本解题1</title>
	<atom:link href="http://cocobear.info/blog/2008/07/10/02-issues-shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://cocobear.info/blog/2008/07/10/02-issues-shell/</link>
	<description>K.I.S.S</description>
	<lastBuildDate>Mon, 30 Jan 2012 11:09:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: dream</title>
		<link>http://cocobear.info/blog/2008/07/10/02-issues-shell/comment-page-1/#comment-3836</link>
		<dc:creator>dream</dc:creator>
		<pubDate>Wed, 16 Jul 2008 09:33:27 +0000</pubDate>
		<guid isPermaLink="false">http://cocobear.info/blog/?p=289#comment-3836</guid>
		<description>哈哈，这回全明白了，太感谢了！</description>
		<content:encoded><![CDATA[<p>哈哈，这回全明白了，太感谢了！</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cocobear</title>
		<link>http://cocobear.info/blog/2008/07/10/02-issues-shell/comment-page-1/#comment-3682</link>
		<dc:creator>cocobear</dc:creator>
		<pubDate>Mon, 14 Jul 2008 03:09:47 +0000</pubDate>
		<guid isPermaLink="false">http://cocobear.info/blog/?p=289#comment-3682</guid>
		<description>1.
man xargs:
       -I replace-str
              Replace occurrences of replace-str in the initial-arguments with
              names  read  from  standard input.  Also, unquoted blanks do not
              terminate input items; instead  the  separator  is  the  newline
              character.

[cocobear@cocobear test]$ find b -name &quot;*.java&quot;&#124;xargs ls {}
ls: 无法访问 {}: 没有那个文件或目录
b/08/07/1.java
[cocobear@cocobear test]$ find b -name &quot;*.java&quot;&#124;xargs -I{} ls {}
b/08/07/1.java

2.
&lt;&lt;&lt;这个我前面说过了，你看看bash手册，那里面提到了。

3.
read就没有这样的用法；参考&lt;&lt;&lt;。</description>
		<content:encoded><![CDATA[<p>1.<br />
man xargs:<br />
       -I replace-str<br />
              Replace occurrences of replace-str in the initial-arguments with<br />
              names  read  from  standard input.  Also, unquoted blanks do not<br />
              terminate input items; instead  the  separator  is  the  newline<br />
              character.</p>
<p>[cocobear@cocobear test]$ find b -name &#8220;*.java&#8221;|xargs ls {}<br />
ls: 无法访问 {}: 没有那个文件或目录<br />
b/08/07/1.java<br />
[cocobear@cocobear test]$ find b -name &#8220;*.java&#8221;|xargs -I{} ls {}<br />
b/08/07/1.java</p>
<p>2.<br />
<<<这个我前面说过了，你看看bash手册，那里面提到了。</p>
<p>3.<br />
read就没有这样的用法；参考<<<。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dream</title>
		<link>http://cocobear.info/blog/2008/07/10/02-issues-shell/comment-page-1/#comment-3675</link>
		<dc:creator>dream</dc:creator>
		<pubDate>Sat, 12 Jul 2008 14:20:11 +0000</pubDate>
		<guid isPermaLink="false">http://cocobear.info/blog/?p=289#comment-3675</guid>
		<description>对不起，有些看懂了，有些还没看懂，能不能帮我再解释一下，真的想学啊～～ 呵呵
1. 在你的例子4中，&quot;find sourcedir -name &quot;*.java&quot;&#124;xargs -I {} cp  --parents {} destdir&quot;。xargs -I {} 是什么意思？{}是指find所找到的内容，那么-I是什么意思？man xargs里没有-I的解释。

2. IFS=: read SERV_CODE APPLICATION ... &lt;&lt;&lt;&quot;$STRING&quot;中，&lt;&lt;&lt;是什么意思？ 以前从没有见过，&lt; 不是作为输入的符号吗？怎么变成&lt;&lt;&lt;了？

3. 我 echo &quot;$STRING&quot;&#124; IFS=: read q w e r t  为什么赋不成值？

谢谢了~ :)</description>
		<content:encoded><![CDATA[<p>对不起，有些看懂了，有些还没看懂，能不能帮我再解释一下，真的想学啊～～ 呵呵<br />
1. 在你的例子4中，&#8221;find sourcedir -name &#8220;*.java&#8221;|xargs -I {} cp  &#8211;parents {} destdir&#8221;。xargs -I {} 是什么意思？{}是指find所找到的内容，那么-I是什么意思？man xargs里没有-I的解释。</p>
<p>2. IFS=: read SERV_CODE APPLICATION &#8230; &lt;&lt;&lt;&#8221;$STRING&#8221;中，&lt;&lt;&lt;是什么意思？ 以前从没有见过，&lt; 不是作为输入的符号吗？怎么变成&lt;&lt;&lt;了？</p>
<p>3. 我 echo &#8220;$STRING&#8221;| IFS=: read q w e r t  为什么赋不成值？</p>
<p>谢谢了~ <img src='http://cocobear.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cocobear</title>
		<link>http://cocobear.info/blog/2008/07/10/02-issues-shell/comment-page-1/#comment-3644</link>
		<dc:creator>cocobear</dc:creator>
		<pubDate>Fri, 11 Jul 2008 03:19:40 +0000</pubDate>
		<guid isPermaLink="false">http://cocobear.info/blog/?p=289#comment-3644</guid>
		<description>to:dream

你可以看看find手册， {} 就是代表前面find找到的结果。xargs是用来执行标准输入的内容

  Here Strings
       A variant of here documents, the format is:

              &lt;&lt;&lt;word

       The word is expanded and supplied to the command on its standard input.


我也是学习中，很多都是别人写的脚本。</description>
		<content:encoded><![CDATA[<p>to:dream</p>
<p>你可以看看find手册， {} 就是代表前面find找到的结果。xargs是用来执行标准输入的内容</p>
<p>  Here Strings<br />
       A variant of here documents, the format is:</p>
<p>              <<<word</p>
<p>       The word is expanded and supplied to the command on its standard input.</p>
<p>我也是学习中，很多都是别人写的脚本。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: luguo</title>
		<link>http://cocobear.info/blog/2008/07/10/02-issues-shell/comment-page-1/#comment-3633</link>
		<dc:creator>luguo</dc:creator>
		<pubDate>Thu, 10 Jul 2008 14:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://cocobear.info/blog/?p=289#comment-3633</guid>
		<description>第1个问题，我的解法：
$ find -type d &#124; awk -F&#039;/&#039; &#039;BEGIN {m=0;l=&quot;&quot; } {if(NF&gt;m){m=NF; l=$0}} END {print l;}&#039;
当然，若有多个最深的它只能得到其中一个。</description>
		<content:encoded><![CDATA[<p>第1个问题，我的解法：<br />
$ find -type d | awk -F&#8217;/&#8217; &#8216;BEGIN {m=0;l=&#8221;" } {if(NF&gt;m){m=NF; l=$0}} END {print l;}&#8217;<br />
当然，若有多个最深的它只能得到其中一个。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: luguo</title>
		<link>http://cocobear.info/blog/2008/07/10/02-issues-shell/comment-page-1/#comment-3632</link>
		<dc:creator>luguo</dc:creator>
		<pubDate>Thu, 10 Jul 2008 12:32:17 +0000</pubDate>
		<guid isPermaLink="false">http://cocobear.info/blog/?p=289#comment-3632</guid>
		<description>我更喜欢：
OLDIFS=$IFS; ....; IFS=$OLDIFS;
最后一个也可以用cut嘛！</description>
		<content:encoded><![CDATA[<p>我更喜欢：<br />
OLDIFS=$IFS; &#8230;.; IFS=$OLDIFS;<br />
最后一个也可以用cut嘛！</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dream</title>
		<link>http://cocobear.info/blog/2008/07/10/02-issues-shell/comment-page-1/#comment-3623</link>
		<dc:creator>dream</dc:creator>
		<pubDate>Thu, 10 Jul 2008 08:46:21 +0000</pubDate>
		<guid isPermaLink="false">http://cocobear.info/blog/?p=289#comment-3623</guid>
		<description>我 echo  &quot;$STRING&quot;&#124; IFS=: read q w e r t
为什么赋不成值？</description>
		<content:encoded><![CDATA[<p>我 echo  &#8220;$STRING&#8221;| IFS=: read q w e r t<br />
为什么赋不成值？</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dream</title>
		<link>http://cocobear.info/blog/2008/07/10/02-issues-shell/comment-page-1/#comment-3622</link>
		<dc:creator>dream</dc:creator>
		<pubDate>Thu, 10 Jul 2008 08:43:17 +0000</pubDate>
		<guid isPermaLink="false">http://cocobear.info/blog/?p=289#comment-3622</guid>
		<description>还有一个问题：
3. IFS=: read SERV_CODE APPLICATION ... &lt;&lt;&lt;&quot;$STRING&quot; 中，为什么要用&lt;&lt;&lt;，而不是&lt;&lt;?</description>
		<content:encoded><![CDATA[<p>还有一个问题：<br />
3. IFS=: read SERV_CODE APPLICATION &#8230; &lt;&lt;&lt;&#8221;$STRING&#8221; 中，为什么要用&lt;&lt;&lt;，而不是&lt;&lt;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dream</title>
		<link>http://cocobear.info/blog/2008/07/10/02-issues-shell/comment-page-1/#comment-3621</link>
		<dc:creator>dream</dc:creator>
		<pubDate>Thu, 10 Jul 2008 08:38:13 +0000</pubDate>
		<guid isPermaLink="false">http://cocobear.info/blog/?p=289#comment-3621</guid>
		<description>请问：
1. find sourcedir -name &quot;*.java&quot;&#124;xargs -I {} cp  --parents {} destdir 中， xargs -I {} 是什么意思？
2. cp  --parents {} destdir 中 {} 是什么意思？

你的解法中, awk用的很多啊 ～
你真是厉害的bash高手～～～</description>
		<content:encoded><![CDATA[<p>请问：<br />
1. find sourcedir -name &#8220;*.java&#8221;|xargs -I {} cp  &#8211;parents {} destdir 中， xargs -I {} 是什么意思？<br />
2. cp  &#8211;parents {} destdir 中 {} 是什么意思？</p>
<p>你的解法中, awk用的很多啊 ～<br />
你真是厉害的bash高手～～～</p>
]]></content:encoded>
	</item>
</channel>
</rss>

