Linux Shell的第一个小程序
来源:互联网 发布:我的淘宝p图 编辑:程序博客网 时间:2024/05/20 18:47
#!/bin/bash# we have less than 3 arguments. Print the help text:if [ $# -lt 3 ]; thencat<<HELP 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' *.HTMHELPexit 0fiOLD="$1"NEW="$2"# The shift command removes one argument from the list of# command line arguments.shiftshift# $* contains now all the files:for file in $*; doif [ -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" fifidone
./ren 'txt$' 'txt1' *.txt
1 0
- Linux Shell的第一个小程序
- Linux Shell 之 我的第一个Shell程序
- Linux Shell 之 我的第一个Shell程序
- Linux 下的第一个Shell脚本程序
- 我的第一个Linux小程序(进度条)
- Linux下的第一个小程序之进度条
- 我的第一个Linux小程序----进度条
- linux 第一个小程序 进度条
- 第一个shell程序
- 第一个shell程序
- 第一个shell程序
- 第一个Shell程序
- 我的第一个shell程序
- 我的第一个shell程序
- 第一个小程序
- 第一个小程序
- 我的IBatisNet第一个小程序
- 我的第一个Python小程序
- ubuntu 14 mesos 集群的配置
- 大数据框架
- c++ 打印简单log信息,输出内容到某一文件中
- 九个大数据的应用领域
- 【C++基础06】引用本质的探究
- Linux Shell的第一个小程序
- 欢迎使用CSDN-markdown编辑器
- 移动支付服务端接口
- JS常用扩展内建对象
- 【持续集成】Jenkins宏观理解
- POJ-1035 - 字符串-暴力
- 面试题
- AngularJS
- python教程