Skip to content

Instantly share code, notes, and snippets.

@jakebellacera
Last active December 22, 2015 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakebellacera/6457909 to your computer and use it in GitHub Desktop.
Save jakebellacera/6457909 to your computer and use it in GitHub Desktop.
BrowserStack tunnel bash script
#!/bin/bash
# BrowserStack Tunnel bash script
# By: Jake Bellacera (http://jakebellacera.com)
#
# Usage:
# browserstack
# browserstack start [opts=localhost,80,0] # starts a tunnel
TUNNEL_KEY="abcdefg12345"
TUNNEL_FILE="/path/to/BrowserStackTunnel.jar"
if [ -n "$1" ]; then
# start [domain]
#
# domain: (optional) the domain to forward
if [ "$1" == "start" ]; then
# Set the domain
if [ -n "$2" ]; then
OPTS="$2"
else
OPTS="localhost,80,0"
fi
echo "starting..."
eval "java -jar $TUNNEL_FILE $TUNNEL_KEY $OPTS"
# default method
# Returns an error
else
echo -en "\033[31m$1: unrecognized command\033[m\n"
printf "$UNRECOGNIZED_COMMAND_MSG"
fi
else
printf "$UNRECOGNIZED_COMMAND_MSG"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment