Skip to content

Instantly share code, notes, and snippets.

@terryp
Last active August 29, 2015 14:02
Show Gist options
  • Save terryp/c9c7036dedaadf985450 to your computer and use it in GitHub Desktop.
Save terryp/c9c7036dedaadf985450 to your computer and use it in GitHub Desktop.
Spent much of the past 24 hours on this. I don't even know why. Well, I think I know - I think I might have this above my PS1 prompt.
#!/bin/bash
#
# Color Reference /
# http://stackoverflow.com/questions/16843382/colored-shell-script-output-library
#
# Text Reset
RCol='\x1b[0m'
# Underline
URed='\x1b[4;31m';
UGr1='\x1b[4;92m';
UGr2='\x1b[4;32m';
function show_versions () {
# Node
NODE_VERSION="node `node --version`";
# Python
PYTHON_VERSION="python v`python -c 'import sys; print sys.version[:5]'`";
# Ruby
RUBY_VERSION="`ruby --version | cut -c 1-10 | sed 's/ruby /ruby v/g'`";
echo -e "${UGr1}$NODE_VERSION${RCol} ${UGr2}$PYTHON_VERSION${RCol} ${URed}$RUBY_VERSION${RCol}";
}
show_versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment