How to show loading bar in Bash shell script

Home > Search > How-to
  by

The following markup can be used to show a loading bar for 20 seconds in a bash shell script.

#!/bin/bash

i=1
while [ $i -le 20 ]
do
    echo -n "."
    i=$(expr $i + 1)
    sleep 1
done

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments