(bash) rudimentary progressbar

This commit is contained in:
2026-08-11 09:33:38 +02:00
parent d84ff9ece8
commit 3627aa5fcb
+21 -3
View File
@@ -1,6 +1,24 @@
#!/usr/bin/env bash #!/usr/bin/env bash
path="$(realpath "${BASH_SOURCE}")" function print_progress {
bar='[ '
for ((k = 0; k < 32; k++)); do
if ((k < (32 * ($2 + 1) / $1))); then
bar+='#'
else
bar+=' '
fi
done
bar+=' ]'
echo -ne "\r${bar}"
}
echo "path: ${path%/*}" files=($(find . -name "*.zig"))
echo "file: ${path##*/}"
echo "${#files[@]}, ${#files}, ${files[@]}"
for n in "${!files[@]}"; do
echo "${files[$n]}"
print_progress ${#files[@]} $n
sleep 1
done