由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 最讨厌的人是。。。
相关主题
Unix在计算机历史上的传奇(转载)java vs javascript
加拿大是码工的祖国,Java,Php,Unix之父都是加拿大人 (转载)问题关于 C中函数形式参数说明
要不要学习 scripting languages such as Python?请教有关header file的几个问题
怎么才能在Unix里连续跑10个c写的程序哪里能找到c++ 的whiteboard的interview questions?
UNIX script匹配问题C语言教材求推荐
[合集] how to call a korn shell script in JAVA program?Dennis Ritchie, father of Unix and C, dies
怎样让一个程序在在UNIX服务器上运行一个script啊?最大的愤怒一般都容易产生伟大的作品
现在哪些script最流行?要进行第二轮面试,HR说是low-key discussion,这是啥意思啊?
相关话题的讨论汇总
话题: master话题: foo话题: programmer话题: unix话题: shell
进入Programming版参与讨论
1 (共1页)
r*********r
发帖数: 3195
1
sys admin... 经常一点点小事搞不定。
很多时候实在难以忍受了,索性自己搞定。
但有时候一些 工具shell script 是 sys admin 写的,
拿来一看,一下子还看不懂。。。
细细琢磨一下,又发现逻辑其实很简单,
难懂的无非就是一些特殊符号,一条命令的某个不常见的选项,etc.
但是等弄完,一天差不多就过去了,什么都没干成。。。 ORZ, 真是要撞墙。
r*********r
发帖数: 3195
2
今天一大早又来琢磨一个 shell script,
发现写 shell 的人一般过于依赖 pipe,
经常是一大串命令用管道串起来,
这种东西真的很脆弱啊,只要其中一个命令 got stuck,
后面的就完全动不了了,也没有报错信息。。。
A**u
发帖数: 2458
3
:-) quang?
r****c
发帖数: 1494
4
http://www.faqs.org/docs/artu/ten-thousand.html
Master Foo and the Ten Thousand Lines
Master Foo once said to a visiting programmer: “There is more Unix-nature
in one line of shell script than there is in ten thousand lines of C.”
The programmer, who was very proud of his mastery of C, said: “How can this
be? C is the language in which the very kernel of Unix is implemented!”
Master Foo replied: “That is so. Nevertheless, there is more Unix-nature in
one line of shell script than there is in ten thousand lines of C.”
The programmer grew distressed. “But through the C language we experience
the enlightenment of the Patriarch Ritchie! We become as one with the
operating system and the machine, reaping matchless performance!”
Master Foo replied: “All that you say is true. But there is still more Unix
-nature in one line of shell script than there is in ten thousand lines of C
.”
The programmer scoffed at Master Foo and rose to depart. But Master Foo
nodded to his student Nubi, who wrote a line of shell script on a nearby
whiteboard, and said: “Master programmer, consider this pipeline.
Implemented in pure C, would it not span ten thousand lines?”
The programmer muttered through his beard, contemplating what Nubi had
written. Finally he agreed that it was so.
“And how many hours would you require to implement and debug that C program
?” asked Nubi.
“Many,” admitted the visiting programmer. “But only a fool would spend
the time to do that when so many more worthy tasks await him.”
“And who better understands the Unix-nature?” Master Foo asked. “Is it he
who writes the ten thousand lines, or he who, perceiving the emptiness of
the task, gains merit by not coding?”
Upon hearing this, the programmer was enlightened.
r*********r
发帖数: 3195
5
raymond 的小故事? 骗骗小孩的。
我觉得shell致命的弱点是把 command 当成 function 来用。
但是 command 出错的机率比一般的 function 高了几个量级,
shell 又没有很好的查错机制 (profiling, debugging,
checking return value, catching exceptions, etc)。
所以大部分的 shell script 比较脆弱。
上次的事,后来还是我自己找到了 stuck 的 command,
又单独 strace 了一下那个命令,才解决问题。
一般不怎么编程的 sys admin,还是不给力。跟编程的人比起来差远了。

【在 r****c 的大作中提到】
: http://www.faqs.org/docs/artu/ten-thousand.html
: Master Foo and the Ten Thousand Lines
: Master Foo once said to a visiting programmer: “There is more Unix-nature
: in one line of shell script than there is in ten thousand lines of C.”
: The programmer, who was very proud of his mastery of C, said: “How can this
: be? C is the language in which the very kernel of Unix is implemented!”
: Master Foo replied: “That is so. Nevertheless, there is more Unix-nature in
: one line of shell script than there is in ten thousand lines of C.”
: The programmer grew distressed. “But through the C language we experience
: the enlightenment of the Patriarch Ritchie! We become as one with the

r*********r
发帖数: 3195
6
the visiting programmer 有找master foo 这闲工夫,
不如把 unix command 的源程序都看一遍。
像什么 find, xargs, sort之类的,解释起来很费劲。
很多书费了半天劲,举了若干垃圾例子,还是讲不清楚。
源代码看一下其实很简单。
r*********r
发帖数: 3195
7
顺便吐糟一下,关于 shell programming, command line 的书出了不少,
大部分都是垃圾书啊。能看得下去的太少了。
1 (共1页)
进入Programming版参与讨论
相关主题
要进行第二轮面试,HR说是low-key discussion,这是啥意思啊?UNIX script匹配问题
Android Developer: $15 per hour[合集] how to call a korn shell script in JAVA program?
本科学历马工当然也能做得比CS PhD牛逼怎样让一个程序在在UNIX服务器上运行一个script啊?
看来Apple hire by reputation现在哪些script最流行?
Unix在计算机历史上的传奇(转载)java vs javascript
加拿大是码工的祖国,Java,Php,Unix之父都是加拿大人 (转载)问题关于 C中函数形式参数说明
要不要学习 scripting languages such as Python?请教有关header file的几个问题
怎么才能在Unix里连续跑10个c写的程序哪里能找到c++ 的whiteboard的interview questions?
相关话题的讨论汇总
话题: master话题: foo话题: programmer话题: unix话题: shell