(bash) rudimentary progressbar
This commit is contained in:
+21
-3
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user