Created
December 4, 2015 15:38
-
-
Save ismailmustafa/e539ba8965f83908a684 to your computer and use it in GitHub Desktop.
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 | |
#Script that opens github link to you repository from terminal | |
set -e | |
remote=$(git remote -v) | |
# split on colon | |
IFS=':' read -ra split_colon <<< "$remote" | |
partial=${split_colon[${#split_colon[@]} - 1]} | |
# split on space | |
IFS=' ' read -ra split_space <<< "$partial" | |
partial2=${split_space[0]} | |
# split on dot | |
IFS='.' read -ra split_dot <<< "$partial2" | |
partial3=${split_dot[0]} | |
# concatenate to form link | |
github_link="https://github.com/" | |
repository_link=$github_link$partial3 | |
# open link | |
open "$repository_link" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment