aboutsummaryrefslogtreecommitdiffstats
path: root/lib/usr/lib/sh/loading.sh
blob: 47c396a1cfa3ee8e97ba86c0d609251dae242f31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
load_machine_config() {
    directory="$1"
    path="${HOME}/${directory}/$(hostname).sh"

    # shellcheck source=/dev/null
    [ -x "$path" ] && . "$path"

    unset directory
    unset path
}

load_config_directory() {
    directory="$1"
    path="${HOME}/${directory}"

    if [ -d "${path}" ]; then
        for f in "${path}/"?*.sh; do
            # shellcheck source=/dev/null
            [ -x "$f" ] && . "$f"
        done
        unset f
    fi
}