| # add this function on your .bashrc file to echoed Go version | |
| function go_version { | |
| version=$(go version) | |
| regex="(go[0-9].[0-9].[0-9])" | |
| if [[ $version =~ $regex ]]; then | |
| echo ${BASH_REMATCH[1]} | |
| fi | |
| } | |
| # and add to your PS1, for example | |
| # PS1="$(go_version) $ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment