Skip to content

Instantly share code, notes, and snippets.

@louisswarren louisswarren/listdays.sh

Last active Feb 20, 2020
Embed
What would you like to do?
List all of the days in a given year
#!/bin/sh
if [ "$1" = "--help" ] || [ $1 = "-h" ]; then
echo "Usage: listdays [year] [format]"
exit
fi
if [ -n "$1" ]; then
year="$1"
else
year=`date "+%Y"`
fi
if [ -n "$2" ]; then
fmt="$2"
else
fmt="+%F (%a %e %b)"
fi
lastdayinc=`date -d "$year-01-01 +1 year -2 day" "+%j"`
for i in `seq 0 $lastdayinc`; do
date -d "$year-01-01 +$i day" "$fmt"
done
2020-01-01 (Wed 1 Jan)
2020-01-02 (Thu 2 Jan)
2020-01-03 (Fri 3 Jan)
2020-01-04 (Sat 4 Jan)
2020-01-05 (Sun 5 Jan)
2020-01-06 (Mon 6 Jan)
2020-01-07 (Tue 7 Jan)
2020-01-08 (Wed 8 Jan)
2020-01-09 (Thu 9 Jan)
2020-01-10 (Fri 10 Jan)
2020-01-11 (Sat 11 Jan)
2020-01-12 (Sun 12 Jan)
2020-01-13 (Mon 13 Jan)
2020-01-14 (Tue 14 Jan)
2020-01-15 (Wed 15 Jan)
2020-01-16 (Thu 16 Jan)
2020-01-17 (Fri 17 Jan)
2020-01-18 (Sat 18 Jan)
2020-01-19 (Sun 19 Jan)
2020-01-20 (Mon 20 Jan)
2020-01-21 (Tue 21 Jan)
2020-01-22 (Wed 22 Jan)
2020-01-23 (Thu 23 Jan)
2020-01-24 (Fri 24 Jan)
2020-01-25 (Sat 25 Jan)
2020-01-26 (Sun 26 Jan)
2020-01-27 (Mon 27 Jan)
2020-01-28 (Tue 28 Jan)
2020-01-29 (Wed 29 Jan)
2020-01-30 (Thu 30 Jan)
2020-01-31 (Fri 31 Jan)
2020-02-01 (Sat 1 Feb)
2020-02-02 (Sun 2 Feb)
2020-02-03 (Mon 3 Feb)
2020-02-04 (Tue 4 Feb)
2020-02-05 (Wed 5 Feb)
2020-02-06 (Thu 6 Feb)
2020-02-07 (Fri 7 Feb)
2020-02-08 (Sat 8 Feb)
2020-02-09 (Sun 9 Feb)
2020-02-10 (Mon 10 Feb)
2020-02-11 (Tue 11 Feb)
2020-02-12 (Wed 12 Feb)
2020-02-13 (Thu 13 Feb)
2020-02-14 (Fri 14 Feb)
2020-02-15 (Sat 15 Feb)
2020-02-16 (Sun 16 Feb)
2020-02-17 (Mon 17 Feb)
2020-02-18 (Tue 18 Feb)
2020-02-19 (Wed 19 Feb)
2020-02-20 (Thu 20 Feb)
2020-02-21 (Fri 21 Feb)
2020-02-22 (Sat 22 Feb)
2020-02-23 (Sun 23 Feb)
2020-02-24 (Mon 24 Feb)
2020-02-25 (Tue 25 Feb)
2020-02-26 (Wed 26 Feb)
2020-02-27 (Thu 27 Feb)
2020-02-28 (Fri 28 Feb)
2020-02-29 (Sat 29 Feb)
2020-03-01 (Sun 1 Mar)
2020-03-02 (Mon 2 Mar)
2020-03-03 (Tue 3 Mar)
2020-03-04 (Wed 4 Mar)
2020-03-05 (Thu 5 Mar)
2020-03-06 (Fri 6 Mar)
2020-03-07 (Sat 7 Mar)
2020-03-08 (Sun 8 Mar)
2020-03-09 (Mon 9 Mar)
2020-03-10 (Tue 10 Mar)
2020-03-11 (Wed 11 Mar)
2020-03-12 (Thu 12 Mar)
2020-03-13 (Fri 13 Mar)
2020-03-14 (Sat 14 Mar)
2020-03-15 (Sun 15 Mar)
2020-03-16 (Mon 16 Mar)
2020-03-17 (Tue 17 Mar)
2020-03-18 (Wed 18 Mar)
2020-03-19 (Thu 19 Mar)
2020-03-20 (Fri 20 Mar)
2020-03-21 (Sat 21 Mar)
2020-03-22 (Sun 22 Mar)
2020-03-23 (Mon 23 Mar)
2020-03-24 (Tue 24 Mar)
2020-03-25 (Wed 25 Mar)
2020-03-26 (Thu 26 Mar)
2020-03-27 (Fri 27 Mar)
2020-03-28 (Sat 28 Mar)
2020-03-29 (Sun 29 Mar)
2020-03-30 (Mon 30 Mar)
2020-03-31 (Tue 31 Mar)
2020-04-01 (Wed 1 Apr)
2020-04-02 (Thu 2 Apr)
2020-04-03 (Fri 3 Apr)
2020-04-04 (Sat 4 Apr)
2020-04-05 (Sun 5 Apr)
2020-04-06 (Mon 6 Apr)
2020-04-07 (Tue 7 Apr)
2020-04-08 (Wed 8 Apr)
2020-04-09 (Thu 9 Apr)
2020-04-10 (Fri 10 Apr)
2020-04-11 (Sat 11 Apr)
2020-04-12 (Sun 12 Apr)
2020-04-13 (Mon 13 Apr)
2020-04-14 (Tue 14 Apr)
2020-04-15 (Wed 15 Apr)
2020-04-16 (Thu 16 Apr)
2020-04-17 (Fri 17 Apr)
2020-04-18 (Sat 18 Apr)
2020-04-19 (Sun 19 Apr)
2020-04-20 (Mon 20 Apr)
2020-04-21 (Tue 21 Apr)
2020-04-22 (Wed 22 Apr)
2020-04-23 (Thu 23 Apr)
2020-04-24 (Fri 24 Apr)
2020-04-25 (Sat 25 Apr)
2020-04-26 (Sun 26 Apr)
2020-04-27 (Mon 27 Apr)
2020-04-28 (Tue 28 Apr)
2020-04-29 (Wed 29 Apr)
2020-04-30 (Thu 30 Apr)
2020-05-01 (Fri 1 May)
2020-05-02 (Sat 2 May)
2020-05-03 (Sun 3 May)
2020-05-04 (Mon 4 May)
2020-05-05 (Tue 5 May)
2020-05-06 (Wed 6 May)
2020-05-07 (Thu 7 May)
2020-05-08 (Fri 8 May)
2020-05-09 (Sat 9 May)
2020-05-10 (Sun 10 May)
2020-05-11 (Mon 11 May)
2020-05-12 (Tue 12 May)
2020-05-13 (Wed 13 May)
2020-05-14 (Thu 14 May)
2020-05-15 (Fri 15 May)
2020-05-16 (Sat 16 May)
2020-05-17 (Sun 17 May)
2020-05-18 (Mon 18 May)
2020-05-19 (Tue 19 May)
2020-05-20 (Wed 20 May)
2020-05-21 (Thu 21 May)
2020-05-22 (Fri 22 May)
2020-05-23 (Sat 23 May)
2020-05-24 (Sun 24 May)
2020-05-25 (Mon 25 May)
2020-05-26 (Tue 26 May)
2020-05-27 (Wed 27 May)
2020-05-28 (Thu 28 May)
2020-05-29 (Fri 29 May)
2020-05-30 (Sat 30 May)
2020-05-31 (Sun 31 May)
2020-06-01 (Mon 1 Jun)
2020-06-02 (Tue 2 Jun)
2020-06-03 (Wed 3 Jun)
2020-06-04 (Thu 4 Jun)
2020-06-05 (Fri 5 Jun)
2020-06-06 (Sat 6 Jun)
2020-06-07 (Sun 7 Jun)
2020-06-08 (Mon 8 Jun)
2020-06-09 (Tue 9 Jun)
2020-06-10 (Wed 10 Jun)
2020-06-11 (Thu 11 Jun)
2020-06-12 (Fri 12 Jun)
2020-06-13 (Sat 13 Jun)
2020-06-14 (Sun 14 Jun)
2020-06-15 (Mon 15 Jun)
2020-06-16 (Tue 16 Jun)
2020-06-17 (Wed 17 Jun)
2020-06-18 (Thu 18 Jun)
2020-06-19 (Fri 19 Jun)
2020-06-20 (Sat 20 Jun)
2020-06-21 (Sun 21 Jun)
2020-06-22 (Mon 22 Jun)
2020-06-23 (Tue 23 Jun)
2020-06-24 (Wed 24 Jun)
2020-06-25 (Thu 25 Jun)
2020-06-26 (Fri 26 Jun)
2020-06-27 (Sat 27 Jun)
2020-06-28 (Sun 28 Jun)
2020-06-29 (Mon 29 Jun)
2020-06-30 (Tue 30 Jun)
2020-07-01 (Wed 1 Jul)
2020-07-02 (Thu 2 Jul)
2020-07-03 (Fri 3 Jul)
2020-07-04 (Sat 4 Jul)
2020-07-05 (Sun 5 Jul)
2020-07-06 (Mon 6 Jul)
2020-07-07 (Tue 7 Jul)
2020-07-08 (Wed 8 Jul)
2020-07-09 (Thu 9 Jul)
2020-07-10 (Fri 10 Jul)
2020-07-11 (Sat 11 Jul)
2020-07-12 (Sun 12 Jul)
2020-07-13 (Mon 13 Jul)
2020-07-14 (Tue 14 Jul)
2020-07-15 (Wed 15 Jul)
2020-07-16 (Thu 16 Jul)
2020-07-17 (Fri 17 Jul)
2020-07-18 (Sat 18 Jul)
2020-07-19 (Sun 19 Jul)
2020-07-20 (Mon 20 Jul)
2020-07-21 (Tue 21 Jul)
2020-07-22 (Wed 22 Jul)
2020-07-23 (Thu 23 Jul)
2020-07-24 (Fri 24 Jul)
2020-07-25 (Sat 25 Jul)
2020-07-26 (Sun 26 Jul)
2020-07-27 (Mon 27 Jul)
2020-07-28 (Tue 28 Jul)
2020-07-29 (Wed 29 Jul)
2020-07-30 (Thu 30 Jul)
2020-07-31 (Fri 31 Jul)
2020-08-01 (Sat 1 Aug)
2020-08-02 (Sun 2 Aug)
2020-08-03 (Mon 3 Aug)
2020-08-04 (Tue 4 Aug)
2020-08-05 (Wed 5 Aug)
2020-08-06 (Thu 6 Aug)
2020-08-07 (Fri 7 Aug)
2020-08-08 (Sat 8 Aug)
2020-08-09 (Sun 9 Aug)
2020-08-10 (Mon 10 Aug)
2020-08-11 (Tue 11 Aug)
2020-08-12 (Wed 12 Aug)
2020-08-13 (Thu 13 Aug)
2020-08-14 (Fri 14 Aug)
2020-08-15 (Sat 15 Aug)
2020-08-16 (Sun 16 Aug)
2020-08-17 (Mon 17 Aug)
2020-08-18 (Tue 18 Aug)
2020-08-19 (Wed 19 Aug)
2020-08-20 (Thu 20 Aug)
2020-08-21 (Fri 21 Aug)
2020-08-22 (Sat 22 Aug)
2020-08-23 (Sun 23 Aug)
2020-08-24 (Mon 24 Aug)
2020-08-25 (Tue 25 Aug)
2020-08-26 (Wed 26 Aug)
2020-08-27 (Thu 27 Aug)
2020-08-28 (Fri 28 Aug)
2020-08-29 (Sat 29 Aug)
2020-08-30 (Sun 30 Aug)
2020-08-31 (Mon 31 Aug)
2020-09-01 (Tue 1 Sep)
2020-09-02 (Wed 2 Sep)
2020-09-03 (Thu 3 Sep)
2020-09-04 (Fri 4 Sep)
2020-09-05 (Sat 5 Sep)
2020-09-06 (Sun 6 Sep)
2020-09-07 (Mon 7 Sep)
2020-09-08 (Tue 8 Sep)
2020-09-09 (Wed 9 Sep)
2020-09-10 (Thu 10 Sep)
2020-09-11 (Fri 11 Sep)
2020-09-12 (Sat 12 Sep)
2020-09-13 (Sun 13 Sep)
2020-09-14 (Mon 14 Sep)
2020-09-15 (Tue 15 Sep)
2020-09-16 (Wed 16 Sep)
2020-09-17 (Thu 17 Sep)
2020-09-18 (Fri 18 Sep)
2020-09-19 (Sat 19 Sep)
2020-09-20 (Sun 20 Sep)
2020-09-21 (Mon 21 Sep)
2020-09-22 (Tue 22 Sep)
2020-09-23 (Wed 23 Sep)
2020-09-24 (Thu 24 Sep)
2020-09-25 (Fri 25 Sep)
2020-09-26 (Sat 26 Sep)
2020-09-27 (Sun 27 Sep)
2020-09-28 (Mon 28 Sep)
2020-09-29 (Tue 29 Sep)
2020-09-30 (Wed 30 Sep)
2020-10-01 (Thu 1 Oct)
2020-10-02 (Fri 2 Oct)
2020-10-03 (Sat 3 Oct)
2020-10-04 (Sun 4 Oct)
2020-10-05 (Mon 5 Oct)
2020-10-06 (Tue 6 Oct)
2020-10-07 (Wed 7 Oct)
2020-10-08 (Thu 8 Oct)
2020-10-09 (Fri 9 Oct)
2020-10-10 (Sat 10 Oct)
2020-10-11 (Sun 11 Oct)
2020-10-12 (Mon 12 Oct)
2020-10-13 (Tue 13 Oct)
2020-10-14 (Wed 14 Oct)
2020-10-15 (Thu 15 Oct)
2020-10-16 (Fri 16 Oct)
2020-10-17 (Sat 17 Oct)
2020-10-18 (Sun 18 Oct)
2020-10-19 (Mon 19 Oct)
2020-10-20 (Tue 20 Oct)
2020-10-21 (Wed 21 Oct)
2020-10-22 (Thu 22 Oct)
2020-10-23 (Fri 23 Oct)
2020-10-24 (Sat 24 Oct)
2020-10-25 (Sun 25 Oct)
2020-10-26 (Mon 26 Oct)
2020-10-27 (Tue 27 Oct)
2020-10-28 (Wed 28 Oct)
2020-10-29 (Thu 29 Oct)
2020-10-30 (Fri 30 Oct)
2020-10-31 (Sat 31 Oct)
2020-11-01 (Sun 1 Nov)
2020-11-02 (Mon 2 Nov)
2020-11-03 (Tue 3 Nov)
2020-11-04 (Wed 4 Nov)
2020-11-05 (Thu 5 Nov)
2020-11-06 (Fri 6 Nov)
2020-11-07 (Sat 7 Nov)
2020-11-08 (Sun 8 Nov)
2020-11-09 (Mon 9 Nov)
2020-11-10 (Tue 10 Nov)
2020-11-11 (Wed 11 Nov)
2020-11-12 (Thu 12 Nov)
2020-11-13 (Fri 13 Nov)
2020-11-14 (Sat 14 Nov)
2020-11-15 (Sun 15 Nov)
2020-11-16 (Mon 16 Nov)
2020-11-17 (Tue 17 Nov)
2020-11-18 (Wed 18 Nov)
2020-11-19 (Thu 19 Nov)
2020-11-20 (Fri 20 Nov)
2020-11-21 (Sat 21 Nov)
2020-11-22 (Sun 22 Nov)
2020-11-23 (Mon 23 Nov)
2020-11-24 (Tue 24 Nov)
2020-11-25 (Wed 25 Nov)
2020-11-26 (Thu 26 Nov)
2020-11-27 (Fri 27 Nov)
2020-11-28 (Sat 28 Nov)
2020-11-29 (Sun 29 Nov)
2020-11-30 (Mon 30 Nov)
2020-12-01 (Tue 1 Dec)
2020-12-02 (Wed 2 Dec)
2020-12-03 (Thu 3 Dec)
2020-12-04 (Fri 4 Dec)
2020-12-05 (Sat 5 Dec)
2020-12-06 (Sun 6 Dec)
2020-12-07 (Mon 7 Dec)
2020-12-08 (Tue 8 Dec)
2020-12-09 (Wed 9 Dec)
2020-12-10 (Thu 10 Dec)
2020-12-11 (Fri 11 Dec)
2020-12-12 (Sat 12 Dec)
2020-12-13 (Sun 13 Dec)
2020-12-14 (Mon 14 Dec)
2020-12-15 (Tue 15 Dec)
2020-12-16 (Wed 16 Dec)
2020-12-17 (Thu 17 Dec)
2020-12-18 (Fri 18 Dec)
2020-12-19 (Sat 19 Dec)
2020-12-20 (Sun 20 Dec)
2020-12-21 (Mon 21 Dec)
2020-12-22 (Tue 22 Dec)
2020-12-23 (Wed 23 Dec)
2020-12-24 (Thu 24 Dec)
2020-12-25 (Fri 25 Dec)
2020-12-26 (Sat 26 Dec)
2020-12-27 (Sun 27 Dec)
2020-12-28 (Mon 28 Dec)
2020-12-29 (Tue 29 Dec)
2020-12-30 (Wed 30 Dec)
2020-12-31 (Thu 31 Dec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.