#!/usr/bin/bash

# apt-get install kdialog && apt-get clean
kdialog --yesno "You're about to type a password. Do you want to continue?"
export rc=$?
if [ "${rc}" == "0" ]; then
  export pass=$(kdialog --password "Enter the password:")
  if [ -z "${pass}" ]; then
     echo "You have typed none."
  else
     echo "You have typed '${pass}'."
  fi
fi