回声控制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 ...
-
如何将多个事件处理程序添加到React.js中的相同事件(How to add multiple event handlers to same event in React.js)[2022-12-19]
如果您想在触发onClick时执行多个回调,您可以让它们从外部传递,以便您可以在道具对象中访问它们。 然后全部执行(注意:代码未经测试): var LikeToggleButton = React.createClass({ toggle: function() { this.setState({liked:!like}); }, handleClick: function(e) { e.preventDefault(); this ... -
编辑 :请参阅ES6更新示例的最终示例。 这个答案只是处理直接亲子关系的情况。 当父母和孩子有潜在的中介人时,请检查这个答案 。 其他解决方案也缺少一点 虽然他们仍然正常工作,但其他答案缺少一些非常重要的答案。 在React.js中,有没有一种简单的方法可以通过事件将孩子的道具传递给父母? 父母已经有那个孩子道具了! :如果孩子有道具,那是因为它的父母为孩子提供了道具! 你为什么要让孩子把道具传给父母,而父母显然已经有了这个道具? 更好的实施 孩子 :真的不一定比这更复杂。 var Child = Reac ...
-
React.js在一个函数中对两个不同输入进行双向绑定(React.js two-way binding for two different inputs in one function)[2022-12-18]
你可以像这样创建一个函数: handleChange = (e) => { this.setState({ [e.target.name]: e.target.value }); } 然后为您的输入和textArea标记添加一个名称属性,如下所示:React.js onclick事件:无法读取未定义的属性'道具'(React.js onclick event: Cannot read property 'props' of undefined)[2023-10-22]
这完全取决于范围。 你的功能不知道this是什么。 你可以在构造函数中绑定this ,或者根据你的环境,其他选项可能更容易。 将其添加到您的构造函数中进行修复: this.termchange = this.termchange.bind(this); this.handleclick = this.handleclick.bind(this); 或者阅读https://blog.andrewray.me/react-es6-autobinding-and-createclass/了解更多详情。 为了简单起 ...@Adam建议通过上下文,但我认为它更像是通过道具的反应。 export const HelloWorld = props => hello.map(helloCode => { return ( ); }); ...第一个,如果你有一个节点列表,你可以通过ListNodes.map((node,index)=>{renderOneNode()}) 。 第二,在function renderOneNode() ,可以为所有节点添加一个事件。 例: ListNodes.map((node,index)=>{ return ({index}); }) 函数doSomething(node)来控制您正 ...您可能会混淆REACT组件和用JSX编写的DOM元素(组件内)之间的用法/关系。 当你将onClick绑定到,你实际上正在将一个prop传递给功能组件 ,名为props.onClick 。 这与将onclick事件附加到DOM元素不同。 您应该将onClick handler传递给组件,此时您将为 提供props. React.render采用在呈现组件时执行的回调: docs ReactComponent render( ReactElement component, DOMElement container, [function callback] ) [...] 如果提供了可选回调,则将在呈现或更新组件后执行该回调。 您可以观察此函数的执行情况,以确定何时渲染组件。 React.render takes a callback that is executed when the component i ...react.js中的事件组成(Event composition in react.js)[2022-02-23]
由于父组件似乎已经知道孩子正在做什么(即它知道孩子中有一些标准的事件处理逻辑),如何在孩子和父母之间建立更强的契约呢? 父级可以将回调传递给在更改时调用的子级。 如果该回调返回除false任何内容,则子进程将继续其通常的事件处理,否则它将停止。 例: var ParentComponent = React.createClass({ handleChange: function(event) { if (!condition_on_event) { return ...相关文章
更多- Java Character类
- Configuring Traffic Storm Control
- storm control
- 配置风暴控制(storm control)
- [掌眼]微信支付测试返回:access_control:not_allow或system:access_denied
- 解决广播风暴的方法:storm-control
- Storm Control
- My W3C Custom Mapping File
- [转] C#开源项目大全
- android遥控器:控制电脑上的暴风影音播放(C#作为服务端)
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)