小编use*_*061的帖子

Linux为什么我不能管道找到rm的结果?

对不起,如果这是一个noobie问题,但我找不到一个好的答案.

要查找然后删除我可以使用的东西

find . -name ".txt" -exec rm "{}" \;
Run Code Online (Sandbox Code Playgroud)

但为什么我不能把结果管道化为rm

find . -name ".txt" | rm 
Run Code Online (Sandbox Code Playgroud)

就像我会把它吹到grep一样

find . -name ".txt" | grep a
Run Code Online (Sandbox Code Playgroud)

我从某个地方读过rm不接受来自stdin的输入,因此我无法管道但是这意味着什么?当我输入rm a.txt时,它会从标准输入中读取,就像我可以直接读取一样吗?或者stdin和命令行之间有区别.救命!

linux bash rm pipe find

45
推荐指数
4
解决办法
3万
查看次数

\ v和\ r是什么意思?它们是白色空间吗?

我正在学习词汇分析课程,并\t\v\r在词法分析器定义中用于表示空格.什么是\v\r准确?

whitespace lexer

19
推荐指数
2
解决办法
2万
查看次数

Javascript扩充Function.prototype

我一直在阅读"javascript:好的部分".

Function.prototype.method = function (name, func) {
     this.prototype[name] = func;
     return this;
};
Run Code Online (Sandbox Code Playgroud)

示例用法是:

Number.method('integer', function () {
    return Math[this < 0 ? 'ceiling' : 'floor'](this);
});
document.writeln((-10 / 3).integer()); // -3
Run Code Online (Sandbox Code Playgroud)

两个问题:

  1. "通过使用方法方法扩充Function.prototype ,我们不再需要输入原型属性的名称.现在可以隐藏这一点丑陋." 那是什么意思?所以它节省了输入".prototype.integer"?似乎并不重要.

  2. 我们进行了扩充Function.prototype,这听起来是功能特有的.Number是本机类型,我们应该增加Object.prototype吗?

javascript

5
推荐指数
1
解决办法
896
查看次数

标签 统计

bash ×1

find ×1

javascript ×1

lexer ×1

linux ×1

pipe ×1

rm ×1

whitespace ×1