28063
|
1 |
#!/usr/bin/env bash
|
|
2 |
#
|
|
3 |
# Author: Makarius
|
|
4 |
#
|
|
5 |
# DESCRIPTION: remove named pipe
|
|
6 |
|
|
7 |
|
|
8 |
PRG="$(basename "$0")"
|
|
9 |
|
|
10 |
function usage()
|
|
11 |
{
|
|
12 |
echo
|
28650
|
13 |
echo "Usage: isabelle $PRG NAME"
|
28063
|
14 |
echo
|
|
15 |
echo " Remove an unused named pipe, after producing dummy output"
|
|
16 |
echo " to unblock the reader (blocks if no reader present)."
|
|
17 |
echo
|
|
18 |
exit 1
|
|
19 |
}
|
|
20 |
|
|
21 |
|
|
22 |
## main
|
|
23 |
|
|
24 |
[ "$#" != 1 ] && usage
|
|
25 |
FIFO="$1"; shift
|
|
26 |
|
|
27 |
if [ -p "$FIFO" ]; then
|
|
28 |
echo -n "" >"$FIFO" && rm -f "$FIFO"
|
|
29 |
fi
|