Created
July 2, 2017 06:20
-
-
Save aizatto/2a097285e09f04beb2a3af56a2277f5e to your computer and use it in GitHub Desktop.
Display node version in bash prompt
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
_node_version() | |
{ | |
local br | |
br=$(node -v) | |
test -n "$br" && printf %s "$br" || : | |
} | |
green=$'\e[1;32m' | |
magenta=$'\e[1;35m' | |
normal_colours=$'\e[m' | |
PS1="${PS1:0:$((${#PS1} - 2))} \[$magenta\]\$(_node_version)\[$normal_colours\]\$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment