每次关闭终端机后,如何使Cowsay说话?


32

我希望Cowsay在关闭终端机时打印“祝您有美好的一天”之类的内容。我知道我必须要有某种脚本,但是我什至不知道如何编写脚本或一旦编写就如何使用它。有什么建议吗?

Answers:


34

您可以尝试添加以下行:

trap 'cowsay "Have a nice day!"; sleep 1' EXIT

到您的.bashrc文件。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.