Is day the word, abbreviation or the numeric? If the numeric does it get prepended with a 0 if it is the 1st through the 9th?
Instead of just d you could have d1, d2 & d3 - egrep (a/k/a grep -E) would then be the way to go:
Code:
#!/bin/bash
egrep -h "$d1|$d2|$d3"/$month/$year *access_log* >> output.txt
In the above the items in the quotes are separated by the pipe symbol which means "or" in this context.