vankuik.nl RecentChanges 2012-02-08 XML TXT

Bash scripting

Script displaying feedback

The following bash function can be included in your scripts to provide feedback to the user whenever an action (such as starting a process) takes time. Instead of the while [ true ], you should put a condition there which can be periodically checked.

 function bounce() {
     dot=1
     while [ true ]; do
         sleep 0.5
         if [ $dot -eq 0 ]; then
             echo -n $'\b'
             echo -n "."
             dot=1
         else
             echo -n $'\b'
             echo -n " "
             dot=0
         fi
     done
 }