#!/bin/bash

pf=/var/tmp/listen

function cleanup {
  if [ -p $pf ]; then
    rm "$pf";
  fi
}

if [ ! -p $pf ]; then
  mkfifo "$pf";
  chmod a+w "$pf";
else
  echo "Listen is already running, exiting."
  exit
fi

trap cleanup EXIT

clear;
echo "Login to $(hostname) and use 'say' to anonymously chat to this terminal:";

while true
do
  cat "$pf";
done
