title: Looping dots until a process is complete? Bash
body: <p>I am trying to create a post-install bash script that I can use when I do fresh installs of Ubuntu. Thefirst feature I want is for the script to prompt the user whether they would like to update their system and if they select yes to display the word "loading" followed by a loop of dots until the process is finished and to export the output to a log file. I have managed to implement all these features except the loop with the dots. </p>
  
  <pre><code>#!/bin/bash
  
  read -p "Update your system? [y/n]" RESP
  if [ "$RESP" = "y" ] || [ "$RESP" = "Y" ] || [ "$RESP" = "Yes" ] || [ $RESP = "yes" ]; then
      echo "Loading..." #dot loop to show that process is occurring    
      sudo apt-get update&gt;&gt;log.txt 2&gt;&amp;1 #when complete want the dots to stop looping.
      echo $?&gt;&gt;log.txt 2&gt;&amp;1  
      echo "UPDATE COMPLETE"&gt;&gt;log.txt 2&gt;&amp;1
      echo "----------------------------------------------------------------------------------------------------------------------------------------------------"&gt;&gt;log.txt 2&gt;&amp;1
      echo "----------------------------------------------------------------------------------------------------------------------------------------------------"&gt;&gt;log.txt 2&gt;&amp;1
      echo "Status=$?"    
      echo "Done"
      sleep 2
      clear
  else
      echo "OK"
  fi
  </code></pre>