如何使用 cat 进行编程?
在此xkcd 漫画中:
他们提到真正的程序员使用 cat
。 好吧,我问自己:如何使用 cat
命令进行编程?
In this xkcd comic:
they mention that real programmers use cat
. Well, I was asking myself: how could you program using the cat
command?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
不,
echo
显然更好:即使您想使用
cat
(猫科动物毕竟很棒),为什么还要费心将源代码放入磁盘呢? 只需将cat
的输出重定向到编译器,就像echo
的情况一样。Nah,
echo
is clearly better:Even if you want to use
cat
(felines are after all wonderful), why bother putting the source to disk? Just redirectcat
's output to the compiler, as in theecho
case.海湾合作委员会? 真正的程序员使用
cat
和xxd
:顺便说一句,我不知道
0xFEEDFACE
是 Mach 中的神奇数字-O 二进制文件...酷。gcc
? real programmers usecat
andxxd
:btw, I didn't know that
0xFEEDFACE
was the magic number in Mach-O binaries... cool.关于这个主题有一本书。
There's a book available on the subject.
我想你可能错过了这个笑话。 关键是
cat
不是一个编辑器;它是一个编辑器。 这只是一种将文本一次性添加到文件中的方法,无需编辑或更正。 你写一次,就这样了。如果你想了解其他事情,你能说得更清楚吗?
I think you might have missed the joke. The point is that
cat
is not an editor; it's simply a way of getting the text into the file in one go, with no editing or correcting. You write it once, and that's it.If you're getting at something else, can you be clearer?
笑话是你不编辑,你只使用
cat
,也许(如果你会变得迟钝的话)......echo
。 例如:然后
重复。
(而且,我一定很无聊才去打字)
The joke is that you don't edit, you just use
cat
and perhaps (if you were going to be obtuse)...echo
. For example:then
repeat.
(also, I must be bored to go and type that out)
让我们看看我们能走多远。
所有这些的输出将是:
Lets see how far we can take this.
the output to all of these will be:
我窃取了接受的和投票最多的答案,并将其与回显答案结合起来,但如果编译成功,我添加了自动条件执行。
I've stolen the accepted and most voted answer and combined it with the echo answer, but I have added automatic conditional execution if compilation was success.
请参阅维基百科有关真正程序员的文章。 您可以在网上找到教程。 最好先了解汇编(非常了解)。
“真正的程序员不使用IDE,他们使用cat > a.out来编写程序”(也就是说,他们从头到尾编写机器可读的二进制文件,不会犯任何错误)。
See Wikipedia article on Real Programmers. You can find tutorials on the web. Best to know assembly first (know it very well).
"Real Programmers don't use IDEs, they write programs using cat > a.out" (that is, they write machine-readable binary files from beginning to end without making any mistakes).
查看此帖子
该帖子有点过时了,因为它对 vsyscall 页面的位置做出了某些假设。 但是如果您有一个运行 2.5.53 内核的 linux 副本,您应该能够运行如下命令:
check this post
The post is a bit out of date, as it makes certain assumptions about the location of the vsyscall page. But if you had a copy of linux running the 2.5.53 kernel, you should be able to run something like: