KEEP K.I.S.S.

tk's blog

命令行、脚本化、自动化以及其他

tk posted @ Nov 21, 2011 03:22:28 PM in 业余 with tags 命令行 脚本 读书 , 2055 阅读

昨晚一个同学问了我一个问题,他跟着导师做项目,问为什么以及怎么去解析特定样式的命令行参数,比如

./DT -r rrr.txt -t ttt.txt -p 0 -s 5 

这里明显是为了脚本化和自动化用的,具体解析就不讲了,其实命令行参数设置可以参考 GNU 风格,比如上面的这个就可以写作

./DT -r,rrr.txt -t,ttt.txt -p,0 -s,5 

GNU 风格的好处在于明辨,参数项和参数值在同一个字符串中,用逗号分隔,进行解析时候就简便一些。命令行的函数好处在于便于使用管道(PIPE)和脚本来实现自动化,避免低效的手工和重复。

这段时间自己在看《程序员修炼之道》,非常好的一本书,感觉到自己有好多的不足,至少从怎么做一个卓有成效的程序员,来讲,我并没有明显的使用脚本去自动化去做一些事情,总是依赖GUI和手工。。。。

其实讲的很多内容并不是局限在编程这个领域,书中也是这么说的,学以致用,卓有成效的手段在各个领域都会有所用处。看来自己还是得不断努力了,不要再愚昧愚蠢的手工重复。。。。。

此书强烈推荐。

 

jsimitseo 说:
Feb 01, 2024 05:47:19 PM

Gives you the best site address I know there alone you'll discover how simple it is.  best concierge doctor

Totobet805 说:
Mar 10, 2026 11:04:21 PM

I'm new to your blog and find your writings to be quite interesting. This is my first visit. Give me adequate information. I appreciate you providing this helpful information, and please remember to keep doing so:

mad casino 说:
Apr 25, 2026 06:45:42 PM

It impresses me. I doubt I've ever met someone with as much knowledge on this topic as you do. You are incredibly clever and well-informed. You made the topic engaging for all readers by writing in a way that was easy to grasp. What a fantastic blog you have here.

DondeGo Business Pro 说:
May 13, 2026 04:37:29 AM

I appreciate your great blog. Where else might I get information conveyed in such a flawless manner? I have a project that I am currently working on, and I have been watching for such info.

coloksgp login 说:
Jun 03, 2026 05:58:43 PM

I have nothing nice to say about this post.I am quite pleased by your content. The author was a wonderful person, and I appreciate you sharing this with us.

alexistogel 说:
Jul 20, 2026 05:41:58 AM

Upon visiting this page, I found a wealth of wonderful information, so much so that I bookmarked it.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter