(bash) rudimentary progressbar
This commit is contained in:
+21
-3
@@ -1,6 +1,24 @@
|
||||
#!/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%/*}"
|
||||
echo "file: ${path##*/}"
|
||||
files=($(find . -name "*.zig"))
|
||||
|
||||
echo "${#files[@]}, ${#files}, ${files[@]}"
|
||||
|
||||
for n in "${!files[@]}"; do
|
||||
echo "${files[$n]}"
|
||||
print_progress ${#files[@]} $n
|
||||
sleep 1
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user