<?xml version="1.0" encoding="GB2312"  ?>
<rss version="2.0">
<channel>
<title>ChinaUnix.net - Shell</title>
<link>http://bbs.chinaunix.net/forumdisplay.php?fid=24</link>
<description>³ýÁË×öÎªÃüÁîÖ±ÒëÆ÷Ö®Íâ, ËüÒ²ÊÇÒ»¸ö²»´íµÄ³ÌÐòÓïÑÔ, ÊÇÏµÍ³¹ÜÀíÎ¬»¤Ê±µÄÖØÒª¹¤¾ß</description><managingEditor>admin@staff.chinaunix.net</managingEditor>
<webMaster>admin@staff.chinaunix.net</webMaster>
<lastBuildDate>2008-03-06 16:46:23</lastBuildDate>
<item>
<title>cygwinÀï›]ÓÐclear command, ×Ô¼º×öÁË‚€Ä£”MµÄ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061681</link>
<author>kelvin</author><pubDate>2008-03-06 15:41:48</pubDate><description><![CDATA[
×÷Õß: kelvin
·¢±íÓÚ: 2008-03-06 15:41:48 (GMT 8)
¼ò½é£º[code]function clear()
{
        (( i = 0 ))
        while (( i< 50 ))
        do
                echo -e "\033[${i};1H
                                    "
                (( i++ ))
        
]]></description>
</item>
<item>
<title>¹ØÓÚÃ¿ÐÐÌí¼ÓÒ»¸ö¡°|¡±µÄÎÊÌâ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061667</link>
<author>jsdb2002</author><pubDate>2008-03-06 15:24:00</pubDate><description><![CDATA[
×÷Õß: jsdb2002
·¢±íÓÚ: 2008-03-06 15:24:00 (GMT 8)
¼ò½é£º1500009 MOT-L7/08.D5.09R MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 
1500029 MAUI MMS User Agent WAP1.X
1500037 NEC-N600/1.0 HopenOS/2.0 WAP1.X
1500037 NEC-N600/1.0 HopenOS/2.0 WAP2.0

ÓÐÉ
]]></description>
</item>
<item>
<title>awkºó,¸³¸ø±äÁ¿,ÖµÎ´¸Ä±ä </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061600</link>
<author>beauty2003</author><pubDate>2008-03-06 13:53:23</pubDate><description><![CDATA[
×÷Õß: beauty2003
·¢±íÓÚ: 2008-03-06 13:53:23 (GMT 8)
¼ò½é£º´ó¼ÒºÃ:
×î½üÓöµ½ÁËÒ»¸ö±È½ÏÓôÃÆµÄÎÊÌâ,Çë´ó¼Ò°ïÖú½â¾öÒ»ÏÂ:
´óÌå¹¦ÄÜÒªÊµÏÖ½«Ò»¸öÎÄ¼þÖÐµÄÅäÖÃ¶Á³ö,²¢¸³¸øÒ»¸ö±äÁ¿.

[color=Red]ÎÄ¼þ(²¿·Ö):[/color]
.........
[path1]
sourepath1=/data/cjtest/tmpdataba
]]></description>
</item>
<item>
<title>Ææ¹ÖµÄ½á¹û£¬Çó¸ßÈËÖ¸µã </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061582</link>
<author>scuhkr</author><pubDate>2008-03-06 13:26:06</pubDate><description><![CDATA[
×÷Õß: scuhkr
·¢±íÓÚ: 2008-03-06 13:26:06 (GMT 8)
¼ò½é£º[code]
#!/bin/sh
 
function check_process()
{
    ps -ef | grep "$0" | grep -v "grep" | wc -l > a.txt  # ÕâÀïa.txtÀï´ð°¸ÊÇ1
    PROC_NUM="`ps -ef | grep "$0"  | grep -v "grep" | wc -l`"  #ÕâÀï ´
]]></description>
</item>
<item>
<title>awkÈçºÎµ¼Èë¹«ÓÃº¯Êý </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061525</link>
<author>meyu</author><pubDate>2008-03-06 11:49:21</pubDate><description><![CDATA[
×÷Õß: meyu
·¢±íÓÚ: 2008-03-06 11:49:21 (GMT 8)
¼ò½é£ºÎÒÏÖÔÚÊ¹ÓÃµÄÊÇigawkµÄinclude¹¦ÄÜ

awk±¾ÉíÓÐÊ²Ã´·½·¨Ã´

-f fileÕâÖÖ·½·¨ºÃÏñÖ»Ö§³Ö awk -f file -f file...,²»Ö§³Ö¼ÈÓÐfile,ÓÖÓÐÖ±½ÓµÄ³ÌÐòÈç awk -f file '{print $0;}'
]]></description>
</item>
<item>
<title>ºñÁ³Æ¤ÎÊÒ»¸öÖØ¶¨ÏòµÄÎÊÌâ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061514</link>
<author>net_lin</author><pubDate>2008-03-06 11:36:45</pubDate><description><![CDATA[
×÷Õß: net_lin
·¢±íÓÚ: 2008-03-06 11:36:45 (GMT 8)
¼ò½é£ºÎÒÏë½«½Å±¾Ö´ÐÐµÄstdoutÐ´Èëµ½Ò»¸öÎÄ¼þÖÐ£¬°ÑstderrÊä³öµ½sedÖÐ½øÐÐ´¦ÀíÈ»ºóÔÚÐ´Èëµ½ÁíÒ»¸öÎÄ¼þÖÐ£¬¿´ÁË13ÎÊ»¹ÊÇÃ»¸ã¶®£¬Çó°ïÖú£¬Ð»Ð»£¡
]]></description>
</item>
<item>
<title>AWKÖÐµÄ¶à·Ö¸î·ûÎÊÌâ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061507</link>
<author>ÎÞÉùÎÞÏ¢</author><pubDate>2008-03-06 11:29:33</pubDate><description><![CDATA[
×÷Õß: ÎÞÉùÎÞÏ¢
·¢±íÓÚ: 2008-03-06 11:29:33 (GMT 8)
¼ò½é£º[code]
$ cat test.txt 
001a-4ba4-37f1   101       Learned          GigabitEthernet0/24    AGING
[/code]
Ô­À´µÄtest.txtÄÚÈÝ
[code]
awk -F"[-/]" '{print $1,$2,$3,$4}' test.txt   
001a 4ba4 37f1  
]]></description>
</item>
<item>
<title>REDHAT AS5ÖÐ×Ô¶¨ÒåµÄRC½Å±¾£¬K´òÍ·µÄ²»Ö´ÐÐ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061503</link>
<author>yuhuohu</author><pubDate>2008-03-06 11:21:36</pubDate><description><![CDATA[
×÷Õß: yuhuohu
·¢±íÓÚ: 2008-03-06 11:21:36 (GMT 8)
¼ò½é£ºÎªÊ²Ã´£¬ÎªÊ²Ã´ÄØ£¿£¿£¿

×Ô¶¨ÒåÒ»¸ö½Å±¾mountgfsÔÚ/etc/init.d/ÖÐ£¬

ÊÖ¹¤Ö´ÐÐ[color=Magenta]service mountgfs start[/color]ºÍ[color=Magenta]service mountgfs stop[/color]£¬¿ÉÒÔË³ÀûÍ¨¹ý£¬½Å±¾×ÔÉí¹¦ÄÜÃ»Î
]]></description>
</item>
<item>
<title>ÇëÎÊÈçºÎÉ¾³ýÕâÑùÃû³ÆµÄÎÄ¼þ¼Ð {}h £¿ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061452</link>
<author>yoshubom</author><pubDate>2008-03-06 10:10:39</pubDate><description><![CDATA[
×÷Õß: yoshubom
·¢±íÓÚ: 2008-03-06 10:10:39 (GMT 8)
¼ò½é£ºÇëÎÊÈçºÎÉ¾³ýÕâÑùÃû³ÆµÄÎÄ¼þ¼Ð {}h £¿
]]></description>
</item>
<item>
<title>ÎÄ±¾ÖÐÁÐ±ä³ÉÐÐµÄÎÊÌâ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061379</link>
<author>Ð¡Óæ´å</author><pubDate>2008-03-06 08:02:15</pubDate><description><![CDATA[
×÷Õß: Ð¡Óæ´å
·¢±íÓÚ: 2008-03-06 08:02:15 (GMT 8)
¼ò½é£ºÏÖÏë½«ÈçÏÂÎÄ±¾ÄÚÈÝ±ä³ÉÐÐÐÎÊ½µÄ¡£Ð¡µÜ²»ÖªµÀ¸ÃÔõÃ´Ð´¡£Çë½Ì¸÷Î»£º

=========192===========
min=1.08 max=2.45 avg=1.515
min=1.16 max=1.45 avg=1.32
min=1.11 max=1.23 avg=1.1625

--------------------
]]></description>
</item>
<item>
<title>Çó½ÌÔÚshellÖÐÊ¹ÓÃsed </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061351</link>
<author>zheliang</author><pubDate>2008-03-05 22:54:18</pubDate><description><![CDATA[
×÷Õß: zheliang
·¢±íÓÚ: 2008-03-05 22:54:18 (GMT 8)
¼ò½é£ºÎÒÔÚlinuxÖÐ£¬Ö´ÐÐ
iptables -t nat -L PREROUTING | sed -n '/192.168.1.184/='
³öÏÖµÄ½á¹ûÎª£º
3
ÎªÊ²Ã´ÎÒ°ÑÕâ¾ä»°·Åµ½shellÎÄ¼þÖÐÔÚÖ´ÐÐ£¬¾¡È»Ã»ÓÐ½á¹û£º
index=`iptables -t nat -L PREROUTING | sed -n '/
]]></description>
</item>
<item>
<title>[Í¼] [×ÊÁÏ] sedË¼Î¬µ¼Í¼£¬Ñ§Ï°sedµÄ²»´í²Î¿¼×ÊÁÏ£¡£¡£¡ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061338</link>
<author>HonestQiao</author><pubDate>2008-03-05 22:17:05</pubDate><description><![CDATA[
×÷Õß: HonestQiao
·¢±íÓÚ: 2008-03-05 22:17:05 (GMT 8)
¼ò½é£º[×ÊÁÏ] sedË¼Î¬µ¼Í¼£¬Ñ§Ï°sedµÄ²»´í²Î¿¼×ÊÁÏ£¡£¡£¡

¡¡¡¡×ªÔØ×Ô£º[url=http://www.lupaworld.com/bbs/viewthread.php?tid=31330]http://www.lupaworld.com/bbs/viewthread.php?tid=31330[/url]
]]></description>
</item>
<item>
<title>Çë½ÌÒ»¸öÎÄ¼þÄÚÈÝ¹ýÂËÎÊÌâ¡£ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061297</link>
<author>yoshubom</author><pubDate>2008-03-05 20:17:40</pubDate><description><![CDATA[
×÷Õß: yoshubom
·¢±íÓÚ: 2008-03-05 20:17:40 (GMT 8)
¼ò½é£ºÎÒÐ´ÁË¸ö½Å±¾£¬ÄÚÈÝÈçÏÂ£º
[code]
begin
data1
data2
data3
data4
data5
data6
end
sed -n '/begin/,/end/{p;}' $0
[/code]

Ô­ÒâÊÇÏ£ÍûÆÁÄ»´òÓ¡³ö

data1
data2
data3
data4
data5
data6

Õâ
]]></description>
</item>
<item>
<title>ls ÁÐ³öÎÄ¼þ£¬ÓÃawk´¦ÀíµÄÒÉÎÊ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061255</link>
<author>dayan_he</author><pubDate>2008-03-05 18:16:34</pubDate><description><![CDATA[
×÷Õß: dayan_he
·¢±íÓÚ: 2008-03-05 18:16:34 (GMT 8)
¼ò½é£º>ls test*

test  test1  test1.new  test.new  test.txt

>ls test* | awk '{print $0}'

 ½á¹ûÎªÊ²Ã´ÊÇ°´ÁÐÅÅµÄ£¬¶ø²»ÊÇ  test  test1  test1.new  test.new  test.txt


ls ÊÇÒ»¸öÒ»¸öÎÄ¼þÃû´«µÝ¸ø awk´
]]></description>
</item>
<item>
<title>ÅÐ¶Ï×Ö·û´®ÊÇ·ñÈ«²¿ÎªÊý×ÖµÄ[[]]·½·¨ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061237</link>
<author>WinnerBoy</author><pubDate>2008-03-05 17:33:44</pubDate><description><![CDATA[
×÷Õß: WinnerBoy
·¢±íÓÚ: 2008-03-05 17:33:44 (GMT 8)
¼ò½é£ºÎÒÏëÅÐ¶ÏÒ»¸ö×Ö·û´®ÊÇ·ñÈ«ÎªÊý×Ö£¬µ±È»ÓÐºÜ¶à·½·¨¡£

ÎÒÕÒµ½Ò»ÖÖ×î¼òµ¥µÄ£¬µ«ÊÇÓöµ½Ò»µãÎÊÌâ£¬Çë°ï°ïÃ¦°¡¡£

ÎÒÕâÃ´Ð´µÄ£º

if [[ "$number" == [b][^0-9][/b] ]];then     
   echo "$number is not a numbe
]]></description>
</item>
<item>
<title>ÎÊÒ»¸öÑ­»·ÎÊÌâ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061220</link>
<author>luotell</author><pubDate>2008-03-05 17:09:35</pubDate><description><![CDATA[
×÷Õß: luotell
·¢±íÓÚ: 2008-03-05 17:09:35 (GMT 8)
¼ò½é£ºÎÒÏÖÔÚÓÐÒ»¸öÎÄ¼þtmp.txt,ÀïÃæÄÚÈÝÎª
100001
200001
300001
ÈçºÎÄÜÊµÏÖfor i in 100001 200001 300001
for i in (cat tmp.txt ) ²»ÐÐ£¬¸÷Î»ÓÐÃ»ÓÐÊ²Ã´°ì·¨£¿Ð»Ð»
]]></description>
</item>
<item>
<title>set -  ºÍ set -- </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061200</link>
<author>WinnerBoy</author><pubDate>2008-03-05 16:44:18</pubDate><description><![CDATA[
×÷Õß: WinnerBoy
·¢±íÓÚ: 2008-03-05 16:44:18 (GMT 8)
¼ò½é£ºset -  ºÍ set --

ÓÐÊ²Ã´Çø±ð£¿

ÎÒÔÚ½Å±¾ÖÐ¶¼¿´µ½¡£
]]></description>
</item>
<item>
<title>¹ØÓÚÎÄ±¾´¦ÀíµÄÎÊÌâ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061191</link>
<author>melonmelon</author><pubDate>2008-03-05 16:32:38</pubDate><description><![CDATA[
×÷Õß: melonmelon
·¢±íÓÚ: 2008-03-05 16:32:38 (GMT 8)
¼ò½é£ºÓÉÓÚÏîÄ¿ÐèÒª,¶øÇÒ±È½Ï×Å¼±,ÎÒÓÖ²»»áshell Ö»ÊÇÉÏÍø²éÁËµã×ÊÁÏ±ßÑ§±ß×ö,½á¹û»¹ÊÇ²»´óÀíÏë,¶ÔÒªÇóµÄÎÄ±¾»¹ÊÇ²»ÄÜÕýÈ·´¦Àí
ÏÖÔÚÓÐÒ»¸öÎÄ¼þ:ss.hÀïÃæÓÖÒ»Ð©ºêµÄ¶¨Òå
#define AAA  222
#define AAA1 1222001    /*sfa
]]></description>
</item>
<item>
<title>sed ÒýÓÃ²ÎÊý </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061189</link>
<author>erin_lyj</author><pubDate>2008-03-05 16:31:44</pubDate><description><![CDATA[
×÷Õß: erin_lyj
·¢±íÓÚ: 2008-03-05 16:31:44 (GMT 8)
¼ò½é£ºÓÐÒ»½Å±¾11.sh£º
sed -n '/$1/h; ${x;p;}' file | awk '{print $3 }'
ÐèÒªÒýÓÃ$1×÷Îª²ÎÊý£¬²é¹ýÏà¹ØµÄÌû×Ó£¬ÐèÒªÓÃÒýºÅ£¬½«½Å±¾¸ÄÎª£º
sed -n "/$1/h; ${x;p;}" file | awk '{print $3 }'
»¹ÊÇ²»ÄÜÖ´ÐÐ
Ð»Ð»
]]></description>
</item>
<item>
<title>Çó¾È£º¹ØÓÚshell½Å±¾ </title>
<link>http://bbs.chinaunix.net/viewthread.php?tid=1061179</link>
<author>alex'yang</author><pubDate>2008-03-05 16:25:42</pubDate><description><![CDATA[
×÷Õß: alex'yang
·¢±íÓÚ: 2008-03-05 16:25:42 (GMT 8)
¼ò½é£ºÎÒÔÚbsd6.2ÏÂ°²×°jkd5£¬²ÉÓÃpkg_addµÄ·½·¨£¬ÔÚ°²×°Ê±»á³öÏÖsunµÄ°²×°Ðí¿ÉÎÄ¼þ£¬Õâ¸öÎÄ¼þ»¹²»ÊÇÒ»´ÎÏÔÊ¾Íê±ÏµÄ£¬±ØÐëÊÖ¶¯µÄ°´¼¸ÏÂ»Ø³µ»ò¿Õ¸ñ²ÅÄÜ³öÏÖÏÂÒ»Ò³Ò»Ö±µ½Íê±Ïºó³öÏÖÊÇ·ñÍ¬ÒâÑ¡Ïî£¬ÕâÊ±»¹ÒªÇÃÈëyes£¨Í¬Òâ£¬¼ÌÐ
]]></description>
</item>
</channel>
</rss>