Installing "Speak IP address on boot

From Projects Wiki
Jump to: navigation, search

Speak IP address on boot

When the Pi uses DHCP to obtain an IP address it can be difficult to determine the address that was assigned. This script will use espeak to have the Pi speak its IP address when it boots. Just plug in an earphone or other appropriate device into the Pi's audio out, execute this script, and you're good to go.

Compiled and submitted by Ed Schoolcraft

#! /bin/sh

sudo apt-get install -y espeak 

cat >speakIP.sh <<DELIM
#! /bin/sh
sleep 2;
private=\`hostname -I\`
string="i p address is \$private"
echo \$string | espeak -a 20 -s 160 -v en-us 2>\/dev\/null
sleep 2;
echo \$string | espeak -a 20 -s 160 -v en-us 2>\/dev\/null
exit 0
DELIM

sudo chmod +x speakIP.sh
sudo mv speakIP.sh /etc/

sudo perl -i.bak -pe 's/^exit 0\b*$/\/etc\/speakIP.sh &\n\nexit 0/g' /etc/rc.local

exit