PyHP/pyhi.sh

17 lines
366 B
Bash
Raw Normal View History

2022-04-05 02:25:06 +02:00
#!/usr/bin/env bash
if [ -z "$PYHP" ]; then
PYHP=""$(dirname "$0")"/pyhp.py"
fi
2022-04-06 04:08:37 +02:00
HYPERTEXT=$("$PYHP" "$PYH" | python3 - "$PATH_TRANSLATED")
2022-04-05 02:25:06 +02:00
# 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
2022-04-05 02:42:42 +02:00
true
2022-04-05 02:25:06 +02:00
else
echo -ne "Content-type: text/html\\n\\n"
fi
2022-04-05 02:42:42 +02:00
2022-04-06 04:08:37 +02:00
echo "$HYPERTEXT"