怎样才能最后命令的挂钟时间的Bash提示符放
问题说明
有没有一种方法嵌入的最后一个命令的墙壁经过一次在猛砸提示?我希望的东西,应该是这样的:
Is there a way to embed the last command's elapsed wall time in a Bash prompt? I'm hoping for something that would look like this:
[last: 0s][/my/dir]$ sleep 10
[last: 10s][/my/dir]$
背景
我经常长时间运行的数据运算工作,是非常有用的知道他们已经采取了多长时间,所以我可以估算它需要多长时间为未来作业。对于非常普通的任务,我继续前进,严格记录使用适当的测井技术信息。对于不太正式的工作,我只是prePEND与时间
命令。
I often run long data-crunching jobs and it's useful to know how long they've taken so I can estimate how long it will take for future jobs. For very regular tasks, I go ahead and record this information rigorously using appropriate logging techniques. For less-formal tasks, I'll just prepend the command with time
.
这将是很好自动时间
每一个交互式命令并打印在几个字符,而不是3行的定时信息。
It would be nice to automatically time
every single interactive command and have the timing information printed in a few characters rather than 3 lines.
正确答案
您可以利用对于bash这个zsh中借用吊钩:<一href=\"http://www.twistedmatrix.com/users/glyph/$p$pexec.bash.txt\">http://www.twistedmatrix.com/users/glyph/$p$pexec.bash.txt
You could utilize this zsh-borrowed hook for bash: http://www.twistedmatrix.com/users/glyph/preexec.bash.txt
与此挂钩(Mac OS X中)来完成时间:使用低吼监控长时间运行shell命令
Timing done with this hook (Mac OS X): Use Growl to monitor long-running shell commands
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhceabhj
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20 -
希伯来语的空格句子标记化错误
it1352 06-22