Use read instead of egrep for reading version files. Closes #41.

This commit is contained in:
Sam Stephenson 2011-08-16 00:01:03 -05:00
parent 6d6b1d6002
commit 71b5965540

View file

@ -1,8 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
# Read the first non-whitespace word from the specified file.
read_version_file() { read_version_file() {
egrep -m 1 '[^[:space:]]' "$1" local words version
while read -a words; do
version="${words[0]}"
if [ -n "$version" ]; then
echo "$version"
break
fi
done < "$1"
} }
DEFAULT_PATH="${HOME}/.rbenv/default" DEFAULT_PATH="${HOME}/.rbenv/default"