背景:每次查看一个命令的帮助信息需要使用命令"svn help cmdname",如"svn help switch",今天我想把30个命令的帮助信息放到一个文件中,便于自己在非命令行状态下使用。
1、获得干净的命令列表,即每行一个命令,没有多余的信息,把内容写入文件svncmd.txt中
[root@localhost svnscript]# svn help| sed -e '1,11d;42,44d'|awk -F ' ' '{ print
$1 }' >svncmd.txt
[root@localhost svnscript]# cat svncmd.txt
add
blame
cat
checkout
cleanup
commit
copy
delete
diff
export
help
import
info
list
lock
log
merge
mkdir
move
propdel
propedit
propget
proplist
propset
resolved
revert
status
switch
unlock
update
2、编写svnhelp.pl,脚本内容如下
[root@localhost svnscript]# cat svnhelp.pl
#!/usr/bin/perl
#Program Name svnhelp.pl
#Program Version:V1.0
#Release Notes:
#V1.0 2011-03-30 Release by leijianfeng
#
#Program Description:
# This program is used to earn the all of svn help command's content
# The file svncmd.txt is contained all of the svn command
open FILE ,"/home/jason/svnscript/svncmd.txt" or die "Can not open FILE:$!";
while(){
print `svn help $_ `
}
3、把我们所需要的内容写入文件svnhelp.txt
perl svnhelp.pl >> svnhelp.txt
ok,svnhelp.txt就是我想我的东东!下面是附件
阅读(857) | 评论(0) | 转发(0) |