28 lines
569 B
Bash
Executable file
28 lines
569 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# Variable
|
|
commands_d="${HOME}/.local/share/updateall/commands.d"
|
|
|
|
# Function
|
|
# Create a clear separator, adapts to the screen size
|
|
function separator {
|
|
local separator=""
|
|
|
|
local name="$1" ; shift
|
|
local char="${1:-=}"; shift
|
|
(( cols = $(tput cols) / 3 ))
|
|
|
|
while [[ ${#separator} -le "$cols" ]]; do
|
|
separator+="$char"
|
|
done
|
|
|
|
printf '\n%s\n\t%s\n%s\n' "$separator" "$name" "$separator"
|
|
}
|
|
|
|
# Loop
|
|
for pm in "${commands_d}/"*; do
|
|
separator "$(basename "$pm")"
|
|
# shellcheck source=/dev/null
|
|
source "$pm"
|
|
done
|
|
|