title: How to get the code to print out Usernames that are between 5 and 10 characters long?
body: <p>I have this code to print all of the usernames in the /etc/passwd file however i am trying to get the code to only print out usernames that are between 5 and 10 characters long does anyone know how i would do this?</p>
  
  <pre><code>#!/bin/bash
  
  MAXLENGTH=$(cut -d: -f1 &lt; /etc/passwd | wc -L)
  MINLENGTH=$MAXLENGTH
  SMALLESTNAME=""
  
  for NAME in $(cut -d: -f1 &lt; /etc/passwd)
  do
  if [ ${#NAME} -eq $MAXLENGTH ]
      then
              echo "The Longest UserName In The System 
  Is:" $NAME
              echo " Its Length Is" $MAXLENGTH
      elif [ ${#NAME} -lt $MINLENGTH ]
      then
              MINLENGTH=${#NAME}
              SMALLESTNAME=$NAME
      fi
  
   done
  
   echo
   echo "The Smallest UserName In The System Is:" 
   $SMALLESTNAME
   echo "Its Length is:" $MINLENGTH
  </code></pre>