您的位置:首页 > 其它

自己写的几个简单常用的脚本

2008-02-01 10:47 477 查看
自己写的几个简单常用的脚本

By:吴垠
Date:2007-02-01
Homepage:http://blog.csdn.net/wooin
Email:lazy_fox#msn.com
版权信息:该文章版权由吴垠和他可爱的老婆小包子所有。可在非商业目的下任意传播和复制。对于商业目的下对本文的任何行为需经作者同意。
联系方式:lazy.fox.wu#gmail.com
1.清除一个svn工作目录中的所有.svn文件夹,包括所有的子目录,使其成为一个普通的文件夹,不再受svn控制。
1 #!/bin/sh
 2 #################################################################################
 3 #       Filename: svn_clear
 4 #         Author: Wu Yin(吴垠)
 5 #          Email: lazy_fox@gmail.com
 6 #        Created: 2007-10-26
 7 #    Description: Clear a svn working copy, make it a nomal directory.
 8 #          Usage: svn_clear [PATH]
 9 #                 "svn_clear" will remove all the ".svn" directory recursively
10 #                 from the PATH you gived. The current directory by default.
11 #################################################################################
12 
13 WORK_PATH=$1
14 if [ -z "$WORK_PATH" ]; then
15     WORK_PATH="."
16 fi
17 
18 for files in `tree -difa $WORK_PATH | grep '.svn$'`
19 do
20     echo "Cleaning" $files " ... "
21     rm -rf $files
22 done
23

2.在所给路径下,或但前路径下创建新的tag文件,或者重建现存的tag文件,tag文件包括Ctags文件和Cscope文件。运行该脚本后应该会生成或更新以下几个文件。
cscope.in.out
cscope.out
cscope.po.out
tags
1 #!/bin/sh
 2 #################################################################################
 3 #        Filename: tag_rebuild
 4 #          Author: Wu Yin(吴垠)
 5 #           Email: lazy_fox@gmail.com
 6 #         Created: 2007-9-19
 7 #     Description: Rebuild Ctags and Cscope files at the path you assign
 8 #           Usage: tag_rebuild [PATH]
 9 #                  "tag_rebuild" will rebuild the Cscope tag file and Ctags 
10 #                  tag file at the PATH you gived. The current directory by default.
11 #                  The following files will be created or rebuilded after you 
12 #                  run "tag_rebuild".
13 #                  > cscope.in.out
14 #                  > cscope.out
15 #                  > cscope.po.out
16 #                  > tags
17 ################################################################################
18 
19 WORK_PATH=$1
20 if [ -z "$WORK_PATH" ]; then
21     WORK_PATH="."
22 fi
23 
24 cd $WORK_PATH
25 
26 echo "Cscope ... " $WORK_PATH
27 cscope -bqR
28 echo "Ctags ... " $WORK_PATH
29 ctags -R --fields=+lS
30

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: