Skip to content

Commit a4528da

Browse files
committed
Bash progress bar
1 parent 0051aa9 commit a4528da

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

linux/progress_bar

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,15 @@ function content_bar {
6262
function int_bar {
6363
bar=$(content_bar '#' $ext_bar_success ${int_bar_size})
6464
percent=$(bc <<< "scale=2; (${ext_bar_success}/${int_bar_size})*100")
65-
echo -ne "[$bar] (${percent}%)\r"
65+
66+
if [ $int_bar_size == $ext_bar_success ]; then
67+
# Complete
68+
echo -ne "[$bar] (${percent}%)\r"
69+
echo -ne '\n'
70+
else
71+
# Add step
72+
echo -ne "[$bar] (${percent}%)\r"
73+
fi
6674
}
6775

6876
function complete_bar {
@@ -92,5 +100,4 @@ elif [ "${DUMMY_BAR}" == "true" ]; then
92100
dummy_bar
93101
else
94102
int_bar
95-
echo ""
96103
fi

0 commit comments

Comments
 (0)