PyHP/pyhi.sh

18 lines
346 B
Bash

#!/usr/bin/env bash
if [ -z "$PYHP" ]; then
PYHP=""$(dirname "$0")"/pyhp.py"
fi
PYH="$1"
shift
HYPERTEXT=$("$PYHP" "$PYH" | python3 - "$@")
# check for headers, if present assume the pyh file is going to handle them
if head -n1 <<< "$HYPERTEXT" | grep "[A-Za-z][A-Za-z0-9\-]*: "; then
;
else
echo -ne "Content-type: text/html\\n\\n"
fi