[英]Executing a command after the first command executed
I just recently installed beep on Ubuntu and finally managed to get it to work. 我最近刚在Ubuntu上安装了哔哔声,最后设法使其工作。 So I was able to hear the beeping sound after executing:
因此执行后我能够听到蜂鸣声:
beep
Everything worked well, however, I was just wondering if it's possible to execute "beep" everytime I execute a command. 一切都运行良好,但是,我只是想知道是否每次执行命令时都可以执行“提示音”。 Say for example:
例如说:
cat /etc/passwd && beep
After reading /etc/passwd, it will be executing a beeping sound. 读完/ etc / passwd后,它将发出哔哔声。 I'd like to know if there's a way to execute beep after every command without having me to use "&& beep" always.
我想知道是否有一种方法可以在每个命令之后执行提示音,而不必总是使用“ && beep”。
A clearer example: 一个更清晰的例子:
ls && beep
ls -la && beep
cat /etc/passwd && beep
Notice the constant command "beep" followed by "&&" after every initial command. 请注意,在每个初始命令之后,常数命令“ beep”后跟“ &&”。
You can set PROMPT_COMMAND=beep
(try it first, then add to your ~/.bashrc
if it doesn't drive you crazy). 您可以设置
PROMPT_COMMAND=beep
(先尝试一下,然后再添加到~/.bashrc
如果它不会使您发疯)。 This will execute beep
just before it displays the command prompt. 这将在显示命令提示符之前执行
beep
。
您可以尝试更改提示:
PS1="$PS1"'\007'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.