Bash function to open git repository with browser

view story

http://askubuntu.com – I'm trying to create a bash function so I can get this. The user, via terminal, goes to the git project path like: /home/daniel/projects/my_super_project So the user will type open and the browser will open in the github.com like: http://github.com/bla/my_super_project.git So far I have this code: function teste { if [ -d .git ]; then remotes=$(git remote -v | awk -F'[email protected]:' '{print $2}' | cut -d" " -f1) url="https://github.com/" url="$url$($remotes | cut -d" " -f1)" # here I'll open the browser else # git rev-parse --git-dir (HowTos)