Skip to content

Instantly share code, notes, and snippets.

@jb0hn
Created September 12, 2018 13:36
Show Gist options
  • Save jb0hn/222ab629b98c8fd8a2c69a71a5e448e0 to your computer and use it in GitHub Desktop.
Save jb0hn/222ab629b98c8fd8a2c69a71a5e448e0 to your computer and use it in GitHub Desktop.
Loading bar
1 #!/bin/bash
2
3 for i in {0..25}
4 do
5 # printf prints command in the same line; echo does not
6 # first slash inform bash that the second one is simple sign
7 printf "\\"
8 # this command allows to clear the command line and start pr inting from the begin
9 echo -ne "\r"
10 # do nothing for 0.15 second
11 sleep 0.15
12 printf "/"
13 echo -ne "\r"
14 sleep 0.15
15 printf "-"
16 echo -ne "\r"
17 sleep 0.15
18 done
~
~
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment