First prototype of extracting and printing version of commands

This commit is contained in:
Kunal Dabir 2015-02-12 19:22:54 +05:30
parent 055457d499
commit 433f670a3f
5 changed files with 24 additions and 9 deletions

View File

@ -9,9 +9,12 @@ if [[ $TERM == xterm-*color ]]; then
FAIL="\E[31m$FAIL\E[0m"
fi
# $1 command name
# $2 0 ok anything else
# $3 version
_dq_report () {
if [ "$2" -eq 0 ]; then
echo -e "$PASS $1"
echo -e "$PASS $1 $3"
OK=$(($OK+1))
else
echo -e "$FAIL $1"

View File

@ -1,2 +1,5 @@
java -version > /dev/null 2>&1
_dq_report 'java' $?
output=$(java -version 2>&1)
status=$?
version=$(echo "$output" | grep -o "\d*\.\d*\.\d*" | head -1)
_dq_report 'java' $status "$version"

View File

@ -1,2 +1,5 @@
python --version > /dev/null 2>&1
_dq_report 'python' $?
output=$(python --version 2>&1)
status=$?
version=$(echo "$output" | grep -o "\d*\.\d*\.\d*" | head -1)
_dq_report 'python' $status "$version"

View File

@ -1,2 +1,5 @@
ruby -v > /dev/null 2>&1
_dq_report 'ruby' $?
output=$(ruby --version 2>&1)
status=$?
version=$(echo "$output" | grep -o "\d*\.\d*\.\d*" | head -1)
_dq_report 'ruby' $status "$version"

View File

@ -1,2 +1,5 @@
groovy --version > /dev/null 2>&1
_dq_report 'groovy' $?
output=$(groovy --version)
status=$?
version=$(echo "$output" | grep -o "\d*\.\d*\.\d*" | head -1)
_dq_report 'groovy' $status "$version"