Last active
August 29, 2015 14:13
-
-
Save ivoarch/f5b401c2e17fa965ff61 to your computer and use it in GitHub Desktop.
Конзолна аларма използвайки mplayer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
# Конзолна аларма използвайки mplayer. | |
PROG="${0##*/}" | |
VERSION="0.1" | |
BANNER="${PROG} ${VERSION}" | |
red=$'\e[0;31m' | |
green=$'\e[0;32m' | |
ylw=$'\e[0;33m' | |
blue=$'\e[0;34m' | |
pur=$'\e[0;35m' | |
end=$'\e[0m' | |
greenb=$'\e[1;32m' | |
clear; | |
printf "%s\n" "${greenb}$BANNER${end}" | |
printf "%s\n" "${blue}Изчакване до алармата във sleep формат.${end}" | |
printf "%s\n" "${ylw}(s)${blue} за секунди, ${ylw}(m)${blue} за минути, ${ylw}(h)${blue} за часове.${end}" | |
printf %s "${pur}Въведете след колко време да алармира:?${end} " | |
read waits | |
while [ -z "$waits" ]; do | |
printf "%s\n" "${red}Моля, въведете нещо, вместо просто да натиснете ENTER. Благодарим ви!${end}" | |
read waits | |
done | |
if [[ "$waits" = [0-9]*[smh] ]]; then | |
printf "%s\n" "${blue}Натиснете ${ylw}'Control + C'${blue} за да спрете алармата.${end}" | |
sleep "${waits}"&& \ | |
mplayer -really-quiet -nolirc -loop 0 \ | |
"/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga" | |
else | |
printf "%s\n" "${red}${waits} е грешно! Моля въведете правилно желаното време до алармата!${end}" | |
exit 1 | |
fi | |
printf "%s\n" "${green}До виждане!${end}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment