Determine and Use Resolution as a Variable in UNIX script on Mac
If you are looking for something to put into a shell script, you can run something like

if [[ $(system_profiler SPDisplaysDataType |
             grep Resolution |
             head -1 |
             tr -d ' ') == 'Resolution:2560x1440' ]]; then
    # do whatever is needed to do for 2560x1440
end if


You could also use a case statement to handle several resolutions

case  $(system_profiler SPDisplaysDataType |
            grep Resolution |
            head -1 |
            tr -d ' ') in
    Resolution:2560x1440)
        # handle 2560x1440
        ...
        ;;
    Resolution:1920x1200)
        # handle 1920x1200
        ...
        ;;
esac