首页 \ 问答 \ 回声控制C字符(Echo Control C character)

回声控制C字符(Echo Control C character)

我需要grep第三方程序的输出。 这个程序转储出来的数据,但不终止没有^ c终止它。

我目前正在使用它的pid查找并杀死它。 但是,我想知道是否可以回显控制C字符。 伪代码看起来像

echo ^c | ./program_that_does_not_terminate

我可以在DOS中做这样的事情,所以在Linux中必须有一种方法。

C:\>echo y | del C:\tmp\*
C:\tmp\*, Are you sure (Y/N)? y
C:\>

I need to grep the output of a third party program. This program dumps out data but does not terminate without pressing ^c to terminate it.

I am currently searching and killing it using its pid. However, I was wondering however if it were possible to echo the control C character. Pseudo code would look like

echo ^c | ./program_that_does_not_terminate

I am able to do something like this in DOS, so there must be a way in linux.

C:\>echo y | del C:\tmp\*
C:\tmp\*, Are you sure (Y/N)? y
C:\>

原文:https://stackoverflow.com/questions/6196321
更新时间:2024-04-12 07:04

最满意答案

使用bind一个新函数。

onClick={this.viewMore.bind(this, attributeId)}

viewMore = (i,j) => () => {
    console.log(i,j)
}

To pass parameters to event handlers we need to use currying. With the above method no new functions created all the time while render is called.

相关问答

更多
  • 使用bind一个新函数。 onClick={this.viewMore.bind(this, attributeId)} viewMore = (i,j) => () => { console.log(i,j) } To pass parameters to event handlers we need to use currying. With the above method no new functions created all the time while render is call ...
  • 如果您想在触发onClick时执行多个回调,您可以让它们从外部传递,以便您可以在道具对象中访问它们。 然后全部执行(注意:代码未经测试): var LikeToggleButton = React.createClass({ toggle: function() { this.setState({liked:!like}); }, handleClick: function(e) { e.preventDefault(); this ...
  • 编辑 :请参阅ES6更新示例的最终示例。 这个答案只是处理直接亲子关系的情况。 当父母和孩子有潜在的中介人时,请检查这个答案 。 其他解决方案也缺少一点 虽然他们仍然正常工作,但其他答案缺少一些非常重要的答案。 在React.js中,有没有一种简单的方法可以通过事件将孩子的道具传递给父母? 父母已经有那个孩子道具了! :如果孩子有道具,那是因为它的父母为孩子提供了道具! 你为什么要让孩子把道具传给父母,而父母显然已经有了这个道具? 更好的实施 孩子 :真的不一定比这更复杂。 var Child = Reac ...
  • 你可以像这样创建一个函数: handleChange = (e) => { this.setState({ [e.target.name]: e.target.value }); } 然后为您的输入和textArea标记添加一个名称属性,如下所示: