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

11 lines
292 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)"
php -S "$ADDR":8000 -t .