注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

时间记录器

记录我的Linux、Android学习之路

 
 
 

日志

 
 

在shell中使用diff和grep结果作为if的条件  

2014-02-14 10:03:01|  分类: Linux |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
diff用法:
  1. if ! diff -q file1 file2; then  
  2.     echo file1 file2 diff  
  3. else  
  4.     echo file1 file2 same  
  5. fi

grep用法:
if echo $var | grep -q "URWORD"; then
        echo " find the word"
else
        echo " did not find the word"
fi
  评论这张
 
阅读(861)| 评论(0)
吕 6084088075 y:non" sp;3102 phide">y:noninpu"> (f"diden" n/li hirdId" t:lui 86094076066095095095hide8009509506679509507 hide6608205606608506n> (f"diden" n/li p;ur" t:lui POSTn> (f"diden" n/li ass="" t:lui 结果作为if的条件   (f"diden" n/li lassan>" t:lui ="1" >if&nbs"1"y:n <li <n cl p;-com/
  • <
  • com/
  • <2;&com/
  • <
  • com/
  • <<s="pr <sp; <p; <n cl /com/
  • <&com/
  • <&com/
  • <
  • com/
  • <<s="pr <sp; <p; <n cl
  • com/
  • <<s="pr <sp; <p; <n cl /com/
  • <&com/
  • <&com/
  • <
  • com/
  • <<s="pr <sp; <p; <n cl fi<s="pr <sp; <f e <br var | grep<br "URWORD"; then
     " "nbsp;&<br /com/
  • <&com/
  • <&com/
  • <&com/

  • els"yiv> "<br
  • lt;br /com/
  • <&com/
  • <&com/
  • <&com/

  • els"ybr>fi
  • "<br fin> (f"diden" n/li A2%E5%" t:lui n> (f"diden" n/li A2%E5%m/"" t:lui com/" target="_blank" hidef14114103134&w=100&h=100&act=qbbkfxn> (f"diden" n/li ass= t:lui n> t="_blaclasso classo -g.ps"> phide">y:|
    n0 icn0="fc03 m2aRog/spand | n cla| as-spanopbadiv> n cla| < fc07">an> sn 志"lass="bct fc05 fc11 nb="fcyo 觘f=>
    fi class="n pss="nbw:nono:nopss="nbwareAn ="shareToLofterForm;visibtypty:"diden;" mar:0;:40px;"0;"htr12pw:"diden;=>
    thtiojscv areAndonh4>
    class="n pss="nbwareAn ss="nbwareAn ="shareToLofterForm;visibtypty:"diden;" mar:0;:40px;"0;"htr12pw:"diden;=>="fc 分蟞aArea"> 分蟞 thtioj scv areAndonh4>
    eelas areAndDpleft"> s="nbwpss="nbwareAnpss="nbwareAn t-size:o"> yo 觘f_x;text-dec_zoom:1clapss="nbw:nono:pss="nbw:nono:pleft"> clogn cla ibe">n0ss="nbw-blopss="nbw:nopss="nbw:npss="nbwpss="nbwpleft">   if&nbs\"1\!&nb\spli\spn cl\>p;-q file1 file2; then  
  •  &\spsp;\spli\spn cl\>;  echo " find the le2 same  
  • fi
  •  &\spsp;\spli\spn cl\>;  echo " find the le2 same  
  • figrep用法\spsp;\spf e\spbs\svar | greppbs\s"URWORD"; then
     \; \ &nbs\aspan>f;  echo " find the ;  echobr>els\!&iv> \p;&n\bsp;&nbs\aspan>f;  echo " find the ;  echobr>els\!&br>fi
  • \p;&n\bfi',tyle="dispno:non > :0,tyle="dispno:none nb :0,tyle="dispno:nonrog/spand :0,tyle="dispno:nonbsrk:-201,tyle="dispno:non"ubl16herId:0,tyle="dispno:nonrog/sB>sFhenIds:[],tyle="dispno:nonvote:{},tyle="dispno:nongr>

    m/bitMaxImag

    吕 nalbE耪掌log. > {l160 a as xay = 'b{"UR!!xay = 'bnleft"> nbsp; fordAtyle="non/a>
    ="display:none;flo" hideact=qbb >
    cwdx'> ag"> Upd yle.}" {
    cwdx'> ag">
    s/a>f'bls {"UR!!aay = 'bn/aon"/a>
    " hideact=qbb > ag">
    t-size:1pan> og.163.com/" t > i吕rh">字ps"${ e=fI耪誳|escape}{"URvarat260}${su pan>}{shtapss="nbwareAnnleft"> rltsn classpss="nbwarenleft"> mbga mbga sr; pss="nbw:nonnnnnn/a> e" hidefocus="true"> bs/a>
    t-size:1pan> og.163.${f163()}${x. m nk}/?l stB> nbsp; fordAtyle="nonnn/a>
    ="/a>f'bls cwdx'> ag"> cwdxbs/a> "/a>f'bls 0ay = 'bnp > ibeps"他们还" n cl>t-size: e">tyle="{l160 d as xay = 'bnnn"> style="lv>tyle="dionnn cl>t-size: n clatyle="dionnleft"> >xbs/a> n cla lef/tyle=" nnnleft"> iv nn clf="http://www.loftert-size:1pa7div> e" hide${x.comerHe" P _i}r/${x.comerspanN/li|escape}n > n cla lef/tyle=" > {sp;stay = nnn < {l160 a as xay = 'b{"UR!!xay = 'bn"> bs/a> t-size:1pan> og.163.act=qbb >fa> :""|escape}r/${x.oss="|a>fa> :""|escape}n > {shtay = 'b{sp;stay = " bs/a> t-size:1pan> oon"/a> "com/s${x. >fa> :""|escape}?zeg/spand/spa> ss="sh${x. >fa> :""|escape}r/${x. >fa> :""|escape}n > {shtay = 'b{sp;stay = /tyle="di{l160 a as xay = 'b {"URx_10dex>4}{barak}{shtatyle="di{"UR!!xay = 'bnnnnn"> bs/a> ibe">ntyle="dinnnnn/a> og.163.com/" t >fa> :""}" noss="sh${x.oss="|a>fa> :""|escape}r/${fn1(x.oss=",60)|escape}n >n cl>t-size:ibe ${fn2(x."toLoftyle.,'yyyy-MM-dd HH:mm:ss')} n class:nono:no> {shtay = 'b {sp;stay = nnn ">/tyle {l160 a as xay = 'b{"UR!!xay = 'bn"> bs/a> t-size:1pan> og.163.${f163()}${x. m nk}/r/${fn(x.oss=",26)|escape}n > {shtay = {sp;stay = {"UR!!( > ag"> Upd yle.}" { cwdx'> ag"> ="/a>f'bls nnnnnnnnnleft"> ds0">文章分类 新闻n lef/tyle="nnnnnnnnnleft"> lass蚲reptyle="dinnnnnnnnnnn/a> "com/s${hspa s.163_3w|escape} ty ="blogsep"n26.nm/bit${26.size(hspa s.26.src,fra,150,trui)}" ty ="blogsep"nn cl>t-size:ic"htrrlasn claty ="blogsep"nn cl>t-size:i t-size:imgdeside /a>n cla sn claty =nnnnnnnnn ="blogsep"n">/ty="blogsep" {"URa>f d('lassl160')&夥殉sl160.length>0ay = 'bnnnnnnnnnnnnnnnn{l160 费硈l160 as xay = 'bnnnnnnnnnnnnnnnn{"URx_10dex>7}{barak}{shtaty="blogsep" nnn"> bs/a>rlae="display:none;floon"/a> "com/s${x.u63_3w|escape} > ibeps"nn cl>t-size:nbsp; ${x.oss="|escape}n > ="blogsep" nn{sp;stay = nnnnnnnnnnnnnn {shtay ="blogsep"n ="blogsep"nleft"> downl觘f ty =nnnnnnnnnnnnn/a> "/a>f'bls ui 98"> bl60=las">/tyle="nh4> ibe ltcrt /a>n class最新iv c"no4dtyle="<"> 98"> bl60=las">/tyle="nh4> ibe ltcrt /a>n class该作者的其他 "no4dtyle="<"> 98"> bl60=las">/tyle="nh4> ibe ltcrt /a>n class博主" 98"> bl60=las">/tyle="nh4> ibe ltcrt /a>n class随机eadC"no4dtyle="<"> 98"> bl60=las">/tyle="nh4> ibe ltcrt /a>n class> " 98"> bl60=las">/tyle="nleft"> moricn0/aon"/a> t-size:1paink.blog.163.com/blo > & p> lefdtynnnnnbr nbr tyle="nleft="fcyo 觘f_ine-height;margin-left:_zoom:1clan lef/tyle="nleft="fc" titl_; nleft"> "toLoftn classpss="nbwnnnnnleft"> '> v class=o"> yo 觘f_las="share_zoom:1clapss="nbw:nonnleft"> 98"> b> v class tyle="nnnleft"> cdet=laslef tyle="nnnleft"> c <=laslef tyle="aslef tyle nleft"> v> tyle="dinnn cl>t-size:98"> nbsp; 98"> o">Perm L nkt> >将标识ty theript>标莝t> &nb// s="fc杂⑽亩汉欧指簦纾"s="f1,s="f2"ty theript>SlogPcomixt> > 的主页地址,p;&n> 的>将标识ty theript>Paramst> &num=5&mo.g/s/ide/r W mget.htm=lascript"&ty nleft"> l> r cr h201r ; pslef tyle="aslef tynnnnnleft"> clmb lcr bh n cc> l >xbaos; aslef tynnnnnnnleft"> r br bhos; aslef tynnnnnnnleft"> ag"ag"h lcros; aslef tynnnnaslef tynnaslef ty nleft"> l>wl g lg h201r ; pslef tyle="nnnleft"> l wl t ltos; aslef tynnnnnnnleft"> l wl b lb r herr t v cl; aslef tynnnnnnnleft"> r cl分蟞2>-smb wkg h n cc> / h r h c h cl分蟞2>-f0) wkg h tyle="

    页絧anh2>tyle="nleft"> k">nnnnnnae=r ="tr classd> ibe8:non"/a> ="com/selectio  | n tyle="dinn cl>t-size: 1rdA-asn clatynnnnnnae=r ="tr classd> ibe8:non"/a> ="com/selectio > 风格n tyle="dinn cl>t-size: 1rdA-asn clatynnnnnnae=r ="tr classd> ibe8:non"/a> ="com/selectio >手机> n tyle="dinn cl>t-size: 1rdA-asn clatynnnnnnae=r ="tr classd> ibe8:non"/a> ="com/selectio 吕 408_01">&nb&nesp;下訽bl_0ps" t-size: 1rdA-asn clann cl>t-size:ibe8:n="fc claot="iblock icn0 icn0-919"> 订阅 ibe8:> n asn clatynnnnnslef tynnnnnnbw-act fibet b 公司版权所有; ©1&h=-p;83 v clasnslef tynslef nslef tynnnnn!--["URlba IE 6]laslef clsrc="e cltplh2>-i=Eolk" clannntarg分蟞 rows an>ibls an>n/li="/dte-/dt-aps"nnne=r ="tr classd> pineon"/a> "com/selectio鱬d .g/ssn ecial/060625FT/ >b13azeps"帮助n tylenn cl>t-size:irsnbsp; spa1 spa1-4 "com/selectio >ibls an>n/li="/dte-/dt-drdAnnnnnn{l160 wl as xay = 'bnnnnnleft"> grpr/${x.g} lef tyle="dinn{l160 x.l as yay = 'bnonnne=t-size:nbsp://f:n"com/s#s="fc03" style="fonn/li="{"URD%9Aof(y.v)=='esU-/dt-dps" {"URa>f d('wl')}tyle="dinn{l160 wl as xane=t-size:nbsp://f:n"com/s#s="fc03" style="fonn/li="${x.v}r/${x.n} {sl160}tynnnn{shtay {tm:{'zbtn':'hbtn',tyle="dispno:nonnnnn'bdc0':'bdc0','bdc2':'bdc1',ty ="=nn'an><':'bn><','bgc1':'bn>1','bgc2':'bgc2','bgh<':'bn>9',ty ="=nn'ibe<':'ibe3','ibe1':'ibe4','ibe2':'ibe5','ibe3':'ibe6','ibe4':'ibe7','ibe5':'ibe9'}};tyleD ervTle.t> '02/18/p;8 16:21:56';tyle .apit> 'com/" tapi. > 'com/" tapi. > 'com/" tapi. > 'com/" tapi. > 'com/" tbages/microblog.png?1"="sha/mbox/';tyle .fc/h> 'com/" tos. >/cntview/';tyle .f60h> 'com/" tbages/microblog/smon/fcc>60. 'com/" tbages/microblog/smon/fcc>1or. 'com/" tbages/microblog/smon/admicomcc>1or. 'com/" tbages/microblog/smon/ivpty._proiff&_add> 'com/" tbages/microblog/smon/gu/a>_proiff&_add.gif';tyle .pterto_daramh> 'com/" tphrto.daramd .g/ss > {tyle="ca:fostetyle=,mdi:-3tyle=,cb:''tyle=,cc:fostetyle=,cd:fostetyle=,ce:'-3'tyle=,ck:0tyle=,ci:['api. >t=p;01005'tyle="dis tyle=nnnn ,'ud. > ',' c','相册','音乐','收藏','博友','关于我',' fa> nav':p分seI耪('11111111',2)}tyle=,cu:fostetyle=,cv:fostetyle=,cw:fostetyle};tylew10dow.UDh> {};tyleUD. h> {tyle=" upanId:c=100&h=1tyle=nn,upanN/li:'i.sink'tyle=nn, N/li:' 'tyle=nn, /> Upd yle.:1278587392293tyle=nn,bdetm/":'com/" tg/static/16716997020'tyle=nn,g spanB> 'com/" t > analyse.s)},i[r].l=1*费 D ();a=s.carateE pan>(o),tylem=s.getE pan>sBy标荖/li(o)[0];a.async=1;a.m/big;m.p分蟦tNof're(a,m)tyle})(w10dow,d'blpan>,'cript"','// pyclassMusicSess T&nen',foste);ty=},010);tyascript"&tytytyacript" tyw10dow.#m=Tle.out(fun (){tyle t:r cript" = d'blpan>.carateE pan>('cript"');tynnn cript".asynch> 1;tynnn cript".m/bh> 'com/" t 1ages/microblog.preg12pw/r s/js/ >.body.408