~ubuntu-branches/ubuntu/wily/rbenv/wily

« back to all changes in this revision

Viewing changes to libexec/rbenv-version-file-read

  • Committer: Package Import Robot
  • Author(s): Antonio Terceiro
  • Date: 2011-09-24 12:27:44 UTC
  • Revision ID: package-import@ubuntu.com-20110924122744-gpszt0huloxxzu6f
Tags: upstream-0.1.2+git20100922
ImportĀ upstreamĀ versionĀ 0.1.2+git20100922

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env bash
 
2
set -e
 
3
[ -n "$RBENV_DEBUG" ] && set -x
 
4
 
 
5
VERSION_FILE="$1"
 
6
 
 
7
if [ -e "$VERSION_FILE" ]; then
 
8
  # Read and print the first non-whitespace word from the specified
 
9
  # version file.
 
10
  while read -a words; do
 
11
    version="${words[0]}"
 
12
    if [ -n "$version" ]; then
 
13
      echo "$version"
 
14
      exit
 
15
    fi
 
16
  done < <( cat "$VERSION_FILE" && echo )
 
17
fi
 
18
 
 
19
exit 1