Alerting the user
It's nice to have your computer beep when an important task has completed and you want to know about it right away. Here's a script I use to beep the internal speaker on my computer:
Chapter 10 – Script 3
#!/bin/sh # # 5/3/2017 # # beep the PC speaker lsmod | grep pcspkr > /dev/null rc=$? if [ $rc -ne 0 ] ; then echo "Please modprobe pcspkr and try again." exit 255 fi echo -e '\a' > /dev/console
This command will beep the PC speaker if it has one and if the driver has been loaded. Note that this command will probably only work on your system when run as the root user.
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime