[分享]Shell编程基础

sh/bash/dash/ksh/zsh等Shell脚本
回复
cr2121
帖子: 46
注册时间: 2009-04-25 9:24

Re: [分享]Shell编程基础

#151

帖子 cr2121 » 2010-10-04 12:54

谢谢楼主! :em11
他山之石,可以攻玉
史上最好用播放器http://tg.player.qq.com/cgi-bin/download?id=411533646
头像
_shendu
帖子: 147
注册时间: 2010-09-17 14:16

Re: [分享]Shell编程基础

#152

帖子 _shendu » 2010-10-09 20:03

mark一下
--总有一条路,是通往幸福的
seckai
帖子: 14
注册时间: 2007-01-24 13:10

Re: [分享]Shell编程基础

#153

帖子 seckai » 2010-10-18 17:02

:em01 嗯,好东西
breakersun
帖子: 2
注册时间: 2010-10-24 11:00

Re: [分享]Shell编程基础

#154

帖子 breakersun » 2010-10-24 15:52

果断马克 :em11
头像
qq420100523
帖子: 1684
注册时间: 2009-07-31 18:56
系统: windows、ubuntu
来自: 广东阳江

Re: [分享]Shell编程基础

#155

帖子 qq420100523 » 2010-10-24 16:00

好文,这个要学习一下。。。
zheng_zhenjie
帖子: 1
注册时间: 2010-11-09 22:37

Re: [分享]Shell编程基础

#156

帖子 zheng_zhenjie » 2010-12-04 13:03

:em06 :em06
头像
icmmed
帖子: 46
注册时间: 2010-12-03 11:08

Re: [分享]Shell编程基础

#157

帖子 icmmed » 2010-12-23 11:10

先顶一下吧
我喜欢忙一点...
Lost Temple...
头像
zhoucga
帖子: 246
注册时间: 2009-06-12 8:55

Re: [分享]Shell编程基础

#158

帖子 zhoucga » 2010-12-23 12:10

:em11
有蛮多实用的 谢谢
青春不是人生的一段时期,而是心灵的一种状况...
bellszhu
帖子: 108
注册时间: 2010-12-18 19:46

Re: [分享]Shell编程基础

#159

帖子 bellszhu » 2010-12-26 16:08

#!/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


是什么意思呀??能不能详细解释下!!谢谢了
keep the faith
suyanbingk
帖子: 19
注册时间: 2011-01-03 20:25

Re: [分享]Shell编程基础

#160

帖子 suyanbingk » 2011-01-03 20:28

好东西啊 :em05
8 mile
帖子: 26
注册时间: 2010-07-21 1:41

Re: [分享]Shell编程基础

#161

帖子 8 mile » 2011-01-05 22:56

支持一个
whao861
帖子: 3
注册时间: 2011-01-10 22:56

Re: [分享]Shell编程基础

#162

帖子 whao861 » 2011-01-10 23:12

顶这个啦。。值得学习的
chw_albert
帖子: 34
注册时间: 2011-01-03 16:18
联系:

Re: [分享]Shell编程基础

#163

帖子 chw_albert » 2011-01-12 19:37

学习下......
在通往牛逼的路上,我一路狂奔!
yjqg6666
帖子: 77
注册时间: 2008-12-31 17:45

Re: [分享]Shell编程基础

#164

帖子 yjqg6666 » 2011-01-31 10:48

seb替换的那个例子还可以使用tr命令 tr "要替换的内容" "替换的内容" >>新文件
yjqg6666
帖子: 77
注册时间: 2008-12-31 17:45

Re: [分享]Shell编程基础

#165

帖子 yjqg6666 » 2011-01-31 10:49

好东西 收藏了 支持lz
回复