Created
December 7, 2015 05:56
-
-
Save kyubuns/9aba4c4d2db433a25969 to your computer and use it in GitHub Desktop.
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/bash | |
readonly MIN_PER_STAMINA=5 | |
function usage() { | |
cat <<_EOT_ | |
Usage: | |
$0 \$1 | |
スタミナが\$1まで回復する時刻 | |
$0 \$1 \$2 | |
スタミナの現在値を\$1として\$2まで回復する時刻 | |
_EOT_ | |
} | |
if [ $# -eq 0 ]; then | |
usage | |
exit 0 | |
fi | |
calc_stamina=0 | |
if [ $# -eq 1 ]; then | |
calc_stamina=$1 | |
fi | |
if [ $# -eq 2 ]; then | |
calc_stamina=$(($2-$1)) | |
fi | |
minutes=$(($calc_stamina*MIN_PER_STAMINA)) | |
eval "date -v+${minutes}M '+%Y/%m/%d %H:%M'" | |
echo "( $minutes 分後)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment