2011-08-18 15:11:40 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2011-09-12 11:11:59 -04:00
|
|
|
[ -n "$RBENV_DEBUG" ] && set -x
|
2011-08-18 15:11:40 -04:00
|
|
|
|
|
|
|
VERSION_FILE="$1"
|
|
|
|
|
|
|
|
if [ -e "$VERSION_FILE" ]; then
|
|
|
|
# Read and print the first non-whitespace word from the specified
|
|
|
|
# version file.
|
2011-09-28 13:06:53 -04:00
|
|
|
version=""
|
2011-08-18 15:11:40 -04:00
|
|
|
while read -a words; do
|
2011-09-28 13:06:53 -04:00
|
|
|
word="${words[0]}"
|
|
|
|
if [ -z "$version" ] && [ -n "$word" ]; then
|
|
|
|
version="$word"
|
2011-08-18 15:11:40 -04:00
|
|
|
fi
|
2011-09-07 15:46:29 -04:00
|
|
|
done < <( cat "$VERSION_FILE" && echo )
|
2011-09-28 13:06:53 -04:00
|
|
|
|
|
|
|
if [ -n "$version" ]; then
|
|
|
|
echo "$version"
|
|
|
|
exit
|
|
|
|
fi
|
2011-08-18 15:11:40 -04:00
|
|
|
fi
|
2011-09-09 16:52:31 -04:00
|
|
|
|
|
|
|
exit 1
|