Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a pretty stupid piece of code for bash that will show a kind of "please wait" rolling display, with the characters : - \ | /

The first problem is that I don't know the name of this thing, so it is a bit difficult to find, and the other is could you please provide a scriptlet please ?

Thank you in advance,


share|improve this question

Thanks a lot for the valuable help. I had a look at all pieces of code, and they all seem pretty long for what I am doing.

So based on that I just redid a tiny piece of code I am sharing with you.

#! /bin/bash
printf "-"
sleep $delay

while [ 1 ]
        printf "\b"
        case $state in
                0) printf "-";;
                1) printf "\\";;
                2) printf "|";;
                3) printf "/";;
        if [ $state -eq 3 ]
        sleep $delay

Of course, this can work as a standalone code, but take out the bash line, and you can insert it easily in a script, and eventually shrink it a bit more. The only thing is about the condition, which is now running forever, so have to get out your own condition for the stop.

Hope you'll find it useful. ;-)

share|improve this answer

They're called 'spinners'. Linux Journal has an article with example code.

share|improve this answer
Can you please include the answer here? Otherwise your post would become obsolete when the link goes down. – slhck Dec 25 '13 at 10:27
I didn't post the answer because (a) it's quite a number of lines of code (especially if additional documentation is included) and I'm not sure if I'm allowed to copy them, (b) this SE isn't specifically about coding and (c) I thought the main question was 'what are these things called' – Teun Vink Dec 25 '13 at 10:30
You could point to the copy at… instead. That is much less likely to go away. – Christopher Creutzig Dec 25 '13 at 10:48
Pointing to an archive is one thing, but in essence we don't want users having to go somewhere else to get an answer. The OP also asked for a script if possible. Of course this is not Stack Overflow but that doesn't mean it's not allowed to post code in your answers :) – slhck Dec 25 '13 at 10:52
His 'first problem' was what these things were called. I answered that. I'm happy to remove the link if that makes it any better. I'm not copying some code I can't take credit for or pointing to a site (partially) copying that site, in my opinion that's disrespectful towards the original author. – Teun Vink Dec 25 '13 at 10:54

They're also called 'Throbbers'. For an implementation plus explanation how to use it see (disclaimer: I haven't tested it myself, but I overlooked it and it looks reasonable)

share|improve this answer

Could you try the below code for "please wait" process bar / spinners.

 echo -e "Please wait ..."
 while true;
 echo -ne '-\r'
 sleep .2
 echo -ne '\\\r'
 sleep .2
 echo -ne '|\r'
 sleep .2
 echo -ne '/''\r'
 sleep .2
 echo -ne '-\r'



 echo -n "Please wait..."
 while true
      echo -n "."
      sleep .2

Its working for me...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.