Create and open a file to take lecture notes depending on day and time
killall Terminal is very harsh!  Maybe you aren't a serious Terminal user now, but someday, you might be doing something important in another Terminal window.  And, due to the way macOS works, multiple windows all run under a single Terminal process, so you would be killing all of your Terminal windows.  At most, do

osascript -e 'tell application "Terminal" to close the front window'


… which sends a message to just one window using AppleScript.  But I would consider even that to be too violent for my taste.



I find those cases too cumbersome to read as conditions.  I would write out all of the combinations, using pattern matching, and in particular, extended pattern matching enabled by shopt -s extglob.

#!/bin/bash

shopt -s extglob

read date hour day month &lt;&lt;&lt; $(date +"%-d %-H %a %B")

case $day.$hour in
    @(Tue|Thu).@(8|9|10|11))
        dir="/path/to/first"
        ;;
    @(Tue|Thu).@(13|14))
        dir="/path/to/second"
        ;;
    Wed.16)
        dir="/path/to/third"
        ;;
    *)
        echo "I am of no use to you right now"
        exit 1
esac
…