32 lines
535 B
Bash
Executable File
32 lines
535 B
Bash
Executable File
#!/bin/sh
|
|
|
|
SOCKET_PATH=""
|
|
if [ -z "$TILDEBIN_SOCK" ]; then
|
|
SOCKET_PATH="/tmp/tildebin.sock"
|
|
else
|
|
SOCKET_PATH="$TILDEBIN_SOCK"
|
|
fi
|
|
|
|
if [ -p /dev/stdin ]; then
|
|
while IFS= read line; do
|
|
input="$input\n$line"
|
|
done
|
|
|
|
if [ ! -z "$1" ]; then
|
|
title="$1"
|
|
fi
|
|
else
|
|
input="$1"
|
|
if [ ! -z "$2" ]; then
|
|
input = "$2"
|
|
title="$1"
|
|
fi
|
|
fi
|
|
|
|
if [ ! -z "$title" ]; then
|
|
echo -e ".name.$title.ename..EOH.$input" | nc -U $SOCKET_PATH
|
|
else
|
|
echo -e ".EOH.$input" | nc -U $SOCKET_PATH
|
|
fi
|
|
|