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