Created
October 12, 2012 14:48
-
-
Save icholy/3879562 to your computer and use it in GitHub Desktop.
quickly link the current dir to /var/www and open the browser there.
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 | |
REG_USER=icholy | |
LINK_NAME=browse | |
LINK_PATH=/var/www/$LINK_NAME | |
BROWSER_CMD=chromium-browser | |
# make sure we're root | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" 1>&2; | |
exit 1; | |
fi | |
# delete old link if one exists | |
if [ -h $LINK_PATH ]; then | |
unlink $LINK_PATH; | |
fi | |
# create the new link | |
ln -s "$(pwd)" $LINK_PATH; | |
# open the browser to the linked dir | |
su $REG_USER -c "${BROWSER_CMD} http://localhost/${LINK_NAME}/"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment