#!/bin/bash # simple alarm using bash script # coded by novatech # http://wan.pengganas.net # for god sake,this script got no version # chmod 777 alarm; usage ./alarm snooz=60 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 >_< then echo "time now $masa" echo "alarm set to $alarm" echo "will play $mp3" else echo "invalid clock format" exit; fi while [ $masa != $alarm ];do masa="`date +%k:%M`" #update time done echo $masa if [ $masa = $alarm ];then echo ringggggggg play $mp3 > /dev/null 2> /dev/null & fi #uncomment below if you want #your alarm to stop at certain time #please edit snooz=60 <-- in second #sleep $snooz #killall play exit