Created
February 16, 2012 01:30
-
-
Save daneharrigan/1840611 to your computer and use it in GitHub Desktop.
add a go command to your shell
This file contains hidden or 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
go() | |
{ | |
local file_name=${1%.*} | |
if [ -n "$1" ]; then | |
__gocompile $file_name | |
__gorun $@ | |
__gocleanup $file_name | |
else | |
echo "The file '$1' does not exist." | |
fi | |
} | |
__gocleanup() | |
{ | |
rm 6.out | |
rm "$1.6" | |
} | |
__gocompile() | |
{ | |
6g "$1.go" | |
6l "$1.6" | |
} | |
__gorun() | |
{ | |
local args=( $@ ) | |
unset args[0] | |
./6.out ${args[@]} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment