diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2019-05-23 11:30:25 +0200 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2019-05-23 11:30:25 +0200 |
commit | 7cde0dc02c0a8349ab7769f934a29cf1578995b5 (patch) | |
tree | 4cefe1f81b76abce02aaac62b0ebc08a3f7870e6 /months.sh | |
parent | c3856a49d47c164991550f10ace030eb6a646ce6 (diff) | |
download | scripts-7cde0dc02c0a8349ab7769f934a29cf1578995b5.tar.gz scripts-7cde0dc02c0a8349ab7769f934a29cf1578995b5.zip |
Changed calendars to bash and standardize code.
Diffstat (limited to 'months.sh')
-rwxr-xr-x | months.sh | 25 |
1 files changed, 12 insertions, 13 deletions
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # _ _ # _ __ ___ ___ _ __ | |_| |__ ___ # | '_ ` _ \ / _ \| '_ \| __| '_ \/ __| @@ -9,33 +9,32 @@ month=$(date +%m) year=$(date +%Y) -cal -m $month $year -read -n 1 input +cal -m "$month" "$year" +read -rn 1 input while [ "$input" != "q" ] do case $input in l) clear - month=$(($month%12+1)) - if [ $month -eq 1 ] + month=$((month%12+1)) + if [ "$month" -eq 1 ] then - year=$(($year+1)) + year=$((year+1)) fi - cal -m $month $year - read -n 1 input ;; h) clear - month=$(($(($month-1))%12)) - if [ $month -eq 0 ] + month=$(($((month-1))%12)) + if [ "$month" -eq 0 ] then month=12 - year=$(($year-1)) + year=$((year-1)) fi - cal -m $month $year - read -n 1 input ;; esac + clear + cal -m "$month" "$year" + read -rn 1 input done |