dotfiles/bin/updateall
2023-06-04 19:39:16 +02:00

32 lines
639 B
Bash
Executable file

#!/bin/bash
# Variables
realpath="$(readlink -f "$0")"
# cd
cd "$(dirname "$realpath")/../share/$(basename "$realpath")" || exit
unset realpath
# Fonction pour fabriquer une ligne de la longueur d'un tiers du terminal
makeline() {
local cols line
cols="$(($(tput cols) / 3))"
while [ "${#line}" -lt "$cols" ]; do
line="${line}${1}"
done
printf %s "$line"
}
# Fonction pour afficher un séparateur
separator() {
local line
line="$(makeline '=')"
printf '\n%s\n\t%s\n%s\n' "$line" "$*" "$line"
}
# Procédure principale
for i in ./commands.d/*; do
separator "$(basename "$i")"
"$i"
done