Last active
March 5, 2016 18:09
-
-
Save fervagar/ec55f2bdaba1f645106a to your computer and use it in GitHub Desktop.
Simple bash script that show 'Loading' with moving points
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| L=`echo $LANG | awk '{split($0,a,"."); print a[1]}'` | |
| case $L in | |
| es_ES) | |
| STRING='Cargando' | |
| LEN=11 | |
| ;; | |
| *) | |
| STRING='Loading' | |
| LEN=10 | |
| ;; | |
| esac | |
| trap ctrl_c INT | |
| function ctrl_c() { | |
| tput cnorm ## Restore the cursor | |
| echo | |
| exit 0 | |
| } | |
| tput civis ## Hide the cursor | |
| while : ## Adjust the time | |
| do | |
| printf "\r%${LEN}s\r%s" ' ' $STRING | |
| for i in `seq 0 2` | |
| do | |
| printf '.'; | |
| sleep 1; | |
| done | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment