experiment目录递归,indent C standard style
来源:互联网 发布:小炫代刷网源码 编辑:程序博客网 时间:2024/06/05 18:17
Linux目录递归改变文件名大小写
[root@localhost Desktop]# ls
experiment-2.6-new.tar.bz2
digui-dir-del-M.sh
digui-dir-indent.sh
experiment
[root@localhost Desktop]#
第一步:
[root@localhost Desktop]# ./digui-dir-del-M.sh experiment
digui-dir-del-M.sh 文件内容如下:
#!/bin/sh
eachd() {
for chkfile in $1/*
do
if [[ -f "$chkfile" ]]
then
result=`file $chkfile |awk '{print $2}'`
if [ "$result" == "ASCII" ]
then
#unix下时,你经常会看见每行文件后面有个讨 厌的^M 字符,有两个简单的方法可以取消它。 用"vi"打开此文件,在Command mode下敲入: :%s/^V^M//g 或者,在UNIX SHELL下敲入: sed 's/^V^M//g' foo > foo.new
# sed -i "s/^M//g" `grep "^M" -rl ./`
#下面这句好使
# sed 's/\r//g' pxa270_buzzer_drv.c >pxa270_buzzer_drv2.c
sed 's/\r//g' $chkfile >temp.c
mv temp.c $chkfile
#echo $chkfile #>> result.txt
fi
fi
if [[ -d $chkfile ]]
then
eachd $chkfile
fi
done
}
#eachd "."
if test -d $1
then
eachd $1
elif test -f $1
then
echo "you input a file but not a directory,pls reinput and try again"
exit 1
else
echo "the Directory isn't exist which you input,pls input a new one!!"
exit 1
fi
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
第二步:
[root@localhost Desktop]# ./digui-dir-indent.sh experiment
digui-dir-indent.sh 文件内容如下:
#!/bin/sh
#http://www.wenzizone.cn/?p=313
#晚上没事,用shell写了个递归遍历目录的脚本,本脚本实现递归遍历指定目录,打印目录下的文件名(全路径)。不为别的,就为了以后用着方便。
function scandir() {
local cur_dir parent_dir workdir
workdir=$1
cd ${workdir}
if [ ${workdir} = "/" ]
then
cur_dir=""
else
cur_dir=$(pwd)
fi
for dirlist in $(ls ${cur_dir})
do
if test -d ${dirlist};then
cd ${dirlist}
scandir ${cur_dir}/${dirlist}
cd ..
else
# echo ${cur_dir}/${dirlist}
indent -npro -kr -i8 -ts8 -sob -l280 -ss -ncs -cp1 *.c *.h
fi
done
}
if test -d $1
then
scandir $1
elif test -f $1
then
echo "you input a file but not a directory,pls reinput and try again"
exit 1
else
echo "the Directory isn't exist which you input,pls input a new one!!"
exit 1
fi
0
上一篇:linux 回收站 路径
下一篇:Linux 系统调用
相关热门文章
- A sample .exrc file for vi e...
- IBM System p5 服务器 HACMP ...
- 游标的特征
- DB2 9 应用开发(733 考试)认...
- busybox的httpd使用CGI脚本(Bu...
- linux dhcp peizhi roc
- 关于Unix文件的软链接
- 求教这个命令什么意思,我是新...
- sed -e "/grep/d" 是什么意思...
- 谁能够帮我解决LINUX 2.6 10...
给主人留下些什么吧!~~
评论热议
0 0
- experiment目录递归,indent C standard style
- experiment目录递归,indent C standard style
- style="text-indent
- The Only Correct Indent Style
- GNU Coding Style、StarDict、splint、indent、《C Traps and Pitfalls》、《Expert C Programming》
- objective-c递归目录
- objective-c目录递归
- Indent tool and K&R code style
- indent格式化C代码
- indent格式化C代码
- C++ Standard Library Style Guidelines
- Objective-C递归创建目录
- Standard C
- Standard C
- experiment
- Experiment
- experiment
- vi+indent+ctag编辑c
- 使用ucenter在第三方应用中实现同步注册与登录
- grub 引导 Win 7
- linux系统权限修复——学生误操作!
- linux 回收站 路径
- 笔记:ITQ
- experiment目录递归,indent C standard style
- Linux 系统调用
- linux网络编程:用C语言实现的聊天程序(异步通信)
- mybatis中的#和$的区别
- 嵌入式方向学习的重点
- 系统扫二维码
- linux网络编程:用C语言实现的聊天程序(同步通信)
- Linux目录递归改变文件名大小写
- mac开发中使用自定义NSTableCellView
原创粉丝点击
热门IT博客
热门问题
老师的惩罚
人脸识别
我在镇武司摸鱼那些年
重生之率土为王
我在大康的咸鱼生活
盘龙之生命进化
天生仙种
凡人之先天五行
春回大明朝
姑娘不必设防,我是瞎子
商务办公室
办公室室内设计
办公室地面装修
办公室租赁价格
办公室装修 效果图
40平米办公室设计
经理办公室
校长办公室装修
服务办公室出租
工业风办公室装修
室内设计办公室
现代办公室
创业租办公室
办公室办公室
办公室植物租赁
办公室文化墙
办公室的装修
精装办公室租赁
10平米办公室装修
新装修办公室
办公室室内装饰
服务式办公室
60平米办公室装修
现代办公室设计
办公室的财位
办公室现代装修
室内办公室装修
服务办公室
办公室 装饰
办公室网络监控
小型办公室 装修
金融办公室装修
租 办公室
12平米办公室装修
150平办公室装修
35平米办公室装修
80平办公室装修
办公室个性装修
装修 办公室
20平米办公室装修
办公室培训班