Created
August 3, 2019 21:01
-
-
Save malicious/73b75e165d5d1abb42ffd0b07c52c57a to your computer and use it in GitHub Desktop.
Revisions
-
malicious created this gist
Aug 3, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ #!/bin/sh set -x # Current time as HH MM # - force leading space, because hours under 10 have a leading space anyway # WHOLE_DATE_STRING=${1:-"$(date "+ %l %M %p" | sed 's/^[[:space:]]*//')"} HOUR_STRING="$( echo "$WHOLE_DATE_STRING" | cut -d' ' -f1)" MINUTE_STRING="$(echo "$WHOLE_DATE_STRING" | cut -d' ' -f2)" AMPM_STRING="$( echo "$WHOLE_DATE_STRING" | cut -d' ' -f3)" case "$MINUTE_STRING" in 00) case $AMPM_STRING in AM) say --voice=Mei-Jia "現在是. 上午 $HOUR_STRING 點鐘" ;; *) say --voice=Mei-Jia "現在是. $HOUR_STRING 點鐘" ;; esac ;; 30) say --voice=Mei-Jia "現在是. $HOUR_STRING 點半" ;; *) say --voice=Mei-Jia "現在是. $HOUR_STRING 點 $MINUTE_STRING 分" ;; esac