aboutsummaryrefslogtreecommitdiff
path: root/months.sh
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2018-11-19 14:13:18 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2018-11-19 14:13:18 +0100
commit683564bd058884356491b7b847f5d2e204207389 (patch)
treec7d60ec611dc6c72fcf885d30051fae9757d67c1 /months.sh
downloadscripts-683564bd058884356491b7b847f5d2e204207389.tar.gz
scripts-683564bd058884356491b7b847f5d2e204207389.zip
Initial scripts commit.
Diffstat (limited to 'months.sh')
-rw-r--r--months.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/months.sh b/months.sh
new file mode 100644
index 0000000..b9d822b
--- /dev/null
+++ b/months.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+# _ _
+# _ __ ___ ___ _ __ | |_| |__ ___
+# | '_ ` _ \ / _ \| '_ \| __| '_ \/ __|
+# | | | | | | (_) | | | | |_| | | \__ \
+# |_| |_| |_|\___/|_| |_|\__|_| |_|___/
+#
+# Navigates through month calendars and exits with q
+
+month=$(date +%m)
+year=$(date +%Y)
+ncal -b -m $month $year
+read -n 1 input
+
+while [ "$input" != "q" ]
+do
+ case $input in
+ l)
+ clear
+ month=$(($month%12+1))
+ if [ $month -eq 1 ]
+ then
+ year=$(($year+1))
+ fi
+ ncal -b -m $month $year
+ read -n 1 input
+ ;;
+ h)
+ clear
+ month=$(($(($month-1))%12))
+ if [ $month -eq 0 ]
+ then
+ month=12
+ year=$(($year-1))
+ fi
+ ncal -b -m $month $year
+ read -n 1 input
+ ;;
+ esac
+done
+