Shell Scripting for rvm ruby listing

Continuing to find nice ways to use quick shell scripts as part of ruby test automation:

Wrote this today (Sunday) in prep for using it at work next week.

function make_sure_rvm_rubies_installed() {

rvm list > $TMP/local_ruby_versions.txt
local_ruby_versions=(1.8.7 1.9.3)

for version in “${local_ruby_versions[@]}”
do
cat $TMP/local_ruby_versions.txt | grep -q $version
version_search_result=$?
if [ $version_search_result = 0 ]
then
echo “Required RVM Ruby version $version confirmed as present on this machine”
else
echo “*** EXITING SMOKE TEST *** – not all required ruby versions are present in RVM”
echo “Please install RVM ruby version: $version and then re-run this program”
exit
fi
done
if [ $? = 0 ]
then
echo “All required Ruby Versions confirmed as present locally”
rm -f $TMP/local_ruby_versions.txt
fi
}

make_sure_rvm_rubies_installed