我只是希望Mac OS X 10.6能像开放suse和其他发行版一样发出硬件哔哔声。我尝试了以下方法

Terminal -> beep = -bash: beep:命令不存在

终端->说哔哔=声音说哔哔(不是硬件的哔哔但很棒;))

applescript -> beep =麦金塔铃声(我想要一个硬件beep!)

有人知道如何在bin/bash或applescript中使硬件发出哔哔声吗?


当前回答

终端类型:

echo -e "\a"

e参数告诉echo处理转义字符。由于\n是新的行字符,\a是钟形字符(与Ctrl+G相同)。

其他回答

确实,下面这段很有效果,也很有旋律:

say -v Bells "dong dong dong"

[更新]不幸的是bell不再包含在最新的OS x中。

say -v Victoria Do your homework!

使用以下方法探索声音:

say -v \?

要了解更多选项,请听并选择

ls /System/Library/Sounds/ | awk '{print $1}' | while read sound; do printf "using $sound...\n"; afplay /System/Library/Sounds/$voice; sleep 0.5; done

ls /System/Library/PrivateFrameworks/ScreenReader.framework/Versions/A/Resources/Sounds/ | awk '{print $1}' | while read sound; do printf "using $voice...\n"; afplay /System/Library/PrivateFrameworks/ScreenReader.framework/Versions/A/Resources/Sounds/$sound; sleep 0.5; done
printf "\a"

如果你看man printf,它会给你一个转义字符列表,包括\a:

\a      Write a <bell> character.

如果你需要什么,听起来就像“important”

你可以使用

tput bel && sleep 0.33s && tput bel && sleep 0.33s && tput bel && sleep 0.33s && tput bel && sleep 0.33s && tput bel && sleep 0.33s && tput bel && sleep 0.33s && tput bel && sleep 0.33s && tput bel && sleep 0.33s && tput bel && sleep 0.33s && tput bel && sleep 0.33s

:)

这适用于我(mac os 10.14.6)

echo "\x07"