mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Use read instead of egrep for reading version files. Closes #41.
This commit is contained in:
parent
6d6b1d6002
commit
71b5965540
1 changed files with 9 additions and 1 deletions
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue