dotfiles/scripts/serve-py
2023-11-16 20:20:11 -06:00

11 lines
300 B
Bash
Executable file

#!/bin/sh
# Look for ifconfig
[ -e "/sbin/ifconfig" ] && CMD="/sbin/ifconfig"
[ -e "$(which ifconfig)" ] && CMD="ifconfig"
[ -n "$CMD" ] || error "ifconfig not found"
# Use ifconfig to get ip address
ADDR="$($CMD | grep -o '192\.168\.[0-9]*\.[0-9]*' | head -n 1)"
python -m http.server -b "$ADDR"