title: Bash time format HH:MM in 12 hour format AM/PM
body: <p>I am trying to print out the time in AM / PM format with this code:</p>
  
  <pre><code> #!/bin/bash
   while [[ $# -gt 0 ]]
    do
    key="$1"
  
  
    case $key in
    --AMPM| --ampm)
    while true;
    do
     #Time in AMPM format:
     echo $(date +"%r")
     sleep 1s;
     clear;
  done
  esac
  done
  </code></pre>
  
  <p>I get this: HH:MM:SS
  I want to get this: HH:MM</p>
  
  <p>How can i alter the code to do so ? or why doesnt it work ? </p>