mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-10 12:33:48 -05:00
Extract rbenv-version-file{,-read,-write}
This commit is contained in:
18
libexec/rbenv-version-file-read
Executable file
18
libexec/rbenv-version-file-read
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
VERSION_FILE="$1"
|
||||
|
||||
if [ -e "$VERSION_FILE" ]; then
|
||||
# Read and print the first non-whitespace word from the specified
|
||||
# version file.
|
||||
while read -a words; do
|
||||
version="${words[0]}"
|
||||
if [ -n "$version" ]; then
|
||||
echo "$version"
|
||||
break
|
||||
fi
|
||||
done < "$VERSION_FILE"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user