Comando family

#!/bin/bash

# Estrategia familiar

time_ () {
    date "+%H" | grep -iq "$1"
}

day_ () {
    date "+%a" | grep -iq "$1"
}

week_ () {
    day_ 'lun' || \
        day_ 'mar' || \
        day_ 'mi'  || \
        day_ 'jue' || \
        day_ 'vie'
}

validate_ () {
    if ( time_ "$1" ) ; then
        if ( week_ ) ; then
            # sleep 20m
            loginctl poweroff
        fi
    fi
    if ( time_ "$1" ) ; then
        if day_ 'sáb' \
                || day_ 'dom'; then
            # sleep 20m
            loginctl poweroff
        fi
    fi
}

evalua_estrategia_familiar () {
    validate_ $1
}

evalua_estrategia_familiar $1
Licencia
CC BY-NC 3.0

Saravia