分页: 11 / 15

Re: [分享]Shell编程基础

发表于 : 2010-10-04 12:54
cr2121
谢谢楼主! :em11

Re: [分享]Shell编程基础

发表于 : 2010-10-09 20:03
_shendu
mark一下

Re: [分享]Shell编程基础

发表于 : 2010-10-18 17:02
seckai
:em01 嗯,好东西

Re: [分享]Shell编程基础

发表于 : 2010-10-24 15:52
breakersun
果断马克 :em11

Re: [分享]Shell编程基础

发表于 : 2010-10-24 16:00
qq420100523
好文,这个要学习一下。。。

Re: [分享]Shell编程基础

发表于 : 2010-12-04 13:03
zheng_zhenjie
:em06 :em06

Re: [分享]Shell编程基础

发表于 : 2010-12-23 11:10
icmmed
先顶一下吧

Re: [分享]Shell编程基础

发表于 : 2010-12-23 12:10
zhoucga
:em11
有蛮多实用的 谢谢

Re: [分享]Shell编程基础

发表于 : 2010-12-26 16:08
bellszhu
#!/bin/sh
# we have less than 3 arguments. Print the help text:
if [ $# -lt 3 ] ; then
cat < ren -- renames a number of files using sed regular expressions

USAGE: ren 'regexp' 'replacement' files...

EXAMPLE: rename all *.HTM files in *.html:
 ren 'HTM$' 'html' *.HTM

HELP
 exit 0

fi
OLD="$1"
NEW="$2"
# The shift command removes one argument from the list of
# command line arguments.
shift
shift
# $* contains now all the files:
for file in $*; do
  if [ -f "$file" ] ; then
   newfile=`echo "$file" | sed "s/${OLD}/${NEW}/g"`
   if [ -f "$newfile" ]; then
    echo "ERROR: $newfile exists already"
   else
    echo "renaming $file to $newfile ..."
    mv "$file" "$newfile"
   fi
  fi
done



上面这段中的:
cat < ren -- renames a number of files using sed regular expressions

USAGE: ren 'regexp' 'replacement' files...

EXAMPLE: rename all *.HTM files in *.html:
 ren 'HTM$' 'html' *.HTM

HELP
 exit 0


是什么意思呀??能不能详细解释下!!谢谢了

Re: [分享]Shell编程基础

发表于 : 2011-01-03 20:28
suyanbingk
好东西啊 :em05

Re: [分享]Shell编程基础

发表于 : 2011-01-05 22:56
8 mile
支持一个

Re: [分享]Shell编程基础

发表于 : 2011-01-10 23:12
whao861
顶这个啦。。值得学习的

Re: [分享]Shell编程基础

发表于 : 2011-01-12 19:37
chw_albert
学习下......

Re: [分享]Shell编程基础

发表于 : 2011-01-31 10:48
yjqg6666
seb替换的那个例子还可以使用tr命令 tr "要替换的内容" "替换的内容" >>新文件

Re: [分享]Shell编程基础

发表于 : 2011-01-31 10:49
yjqg6666
好东西 收藏了 支持lz