How can the last command's wall time be put in the Bash prompt?

后端 未结 14 2807
無奈伤痛
無奈伤痛 2020-12-04 05:16

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]$ sl         


        
14条回答
  •  [愿得一人]
    2020-12-04 05:56

    You could utilize this zsh-borrowed hook for bash: http://www.twistedmatrix.com/users/glyph/preexec.bash.txt

    Timing done with this hook (Mac OS X): Use Growl to monitor long-running shell commands

提交回复
热议问题