Skip to content

Instantly share code, notes, and snippets.

@baurine
Created September 21, 2016 07:16
Show Gist options
  • Save baurine/2c6f401eea18196382c74cd77bf53132 to your computer and use it in GitHub Desktop.
Save baurine/2c6f401eea18196382c74cd77bf53132 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
usage() {
echo "Usage:"
echo " run_with_ip"
echo " run_with_ip ip"
}
arg=$1
if [ -z "$arg" ]; then
rails s
elif [ $arg == "ip" ]; then
ip=$(ifconfig en0 | grep 'inet\b' | awk '{print $2}')
rails s -b $ip
else
usage
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment