Skip to content

Instantly share code, notes, and snippets.

@fervagar
Last active March 5, 2016 18:09
Show Gist options
  • Select an option

  • Save fervagar/ec55f2bdaba1f645106a to your computer and use it in GitHub Desktop.

Select an option

Save fervagar/ec55f2bdaba1f645106a to your computer and use it in GitHub Desktop.

Revisions

  1. fervagar revised this gist Mar 5, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions load_animation.sh
    Original file line number Diff line number Diff line change
    @@ -7,8 +7,8 @@ case $L in
    LEN=11
    ;;
    *)
    STRING='Loading'
    LEN=10
    STRING='Loading'
    LEN=10
    ;;
    esac

  2. fervagar created this gist Mar 4, 2016.
    33 changes: 33 additions & 0 deletions load_animation.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    #!/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