#!/bin/bash
echo "OK Pleased to meet you"
password="12345678"
prompt=PIN
while read -r line; do
  # echo "$line" >> /tmp/mock-pin.log
  if [[ "$line" =~ SETPROMPT ]]; then
    prompt="$line"
  fi
  if [[ $line =~ GETPIN ]]; then
      echo -n "D "
      if [[ "$prompt" =~ Admin ]]; then
        echo "12345678"
      elif [[ "$prompt" =~ PIN ]]; then
        echo "123456"
      else
        echo "12345678"
      fi
  fi
  echo "OK";
done
