-
-
Save srph/c6d7bf0b9c6c04354dad to your computer and use it in GitHub Desktop.
Shorthand bash script for PHP SAPI (Built-in Web Server)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: sapi [port] | |
# Examples: sapi 5k, 5000 | |
PORT=$1 | |
if [ "$PORT" == "" ]; then | |
PORT=8080 | |
elif [ "${PORT:$((${#PORT} - 1)), -1}" == "k" ]; then | |
PORT="${PORT%?}000" | |
fi | |
php -S localhost:$PORT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment