Selasa, 29 Januari 2008

simple alarm clock with bash scripting

Ini gue ambil dari internet juga tuk di bagi2 bersama , bravo linux

here is a simple bash programming that will execute alarm when it reach certain time setup by user

initially i coded just for exercise on bash scripting (practice make perfect right?) but i think it’s a good idea to share it with other people

here’s the code
#!/bin/bash
masa="`date +%k:%M`"
mp3="$HOME/Desktop/alarm.mp3" #change this

if [ $# != 1 ]; then
echo "please insert alarm time [24hours format]"
echo "example ./alarm 13:00 [will ring alarm at 1:00pm]"
exit;
fi
alarm=$1
if [[ "$alarm" =~ ^[0-2][0-9]\:[0-5][0-9]$ ]]
#fix me with better regex >_< masa="`date +%k:%M`" masa =" $alarm"> /dev/null 2> /dev/null &
fi
exit

Tidak ada komentar: