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.
Simple bash script that show 'Loading' with moving points
#!/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