lib/Tools/rmfifo
author haftmann
Fri, 04 Jun 2010 19:36:41 +0200
changeset 37337 c0cf8b6c2c26
parent 29143 72c960b2b83e
permissions -rwxr-xr-x
avoid "$"

#!/usr/bin/env bash
#
# Author: Makarius
#
# DESCRIPTION: remove named pipe


PRG="$(basename "$0")"

function usage()
{
  echo
  echo "Usage: isabelle $PRG NAME"
  echo
  echo "  Remove an unused named pipe, after producing dummy output"
  echo "  to unblock the reader (blocks if no reader present)."
  echo
  exit 1
}


## main

[ "$#" != 1 ] && usage
FIFO="$1"; shift

if [ -p "$FIFO" ]; then
  echo -n "" >"$FIFO" && rm -f "$FIFO"
fi