helix-scripts/helix-man.sh
2024-06-16 11:03:50 +02:00

25 lines
417 B
Bash

#!/bin/bash
PORT=$1
if [ "$PORT" = "" ] ; then
export PORT=7400
fi
nc localhost $PORT < /dev/null | (
echo &
while true; do
read PAGE || break
TOKILL="$(ps --ppid $MANPID -o pid=)"
kill $TOKILL > /dev/null
echo displaying $PAGE
man -P less -s 2:3:1p:9:1 $PAGE &
MANPID=$!
sleep 0.1
done
TOKILL="$(ps --ppid $MANPID -o pid=)"
kill $TOKILL > /dev/null
) 2> /dev/null
exit 0