I want to install rbenv on Ubuntu on Windows (Windows Subsystem for Linux) and cloned the git repository to the subsystem users home folder. When running the init script however (in zsh + oh-my-zsh), I get the following error:
/home/main/.rbenv/bin/rbenv: line 2: set: -
: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
/home/main/.rbenv/bin/rbenv: line 3: unset: `CDPATH
': not a valid identifier
/home/main/.rbenv/bin/rbenv: line 4: $'\r': command not found
/home/main/.rbenv/bin/rbenv: line 15: syntax error near unexpected token `$'{\r''
/home/main/.rbenv/bin/rbenv: line 15: `abort() {
'
I'm not sure who's to blame here, zsh or rbenv.
EDIT1: Also doesn't work with bash.
This problem was caused because of (wierdly) git assuming that the OS is windows and converted the files to CRLF on checkout.
To fix this I ran dos2unix over the whole rbenv folder:
find ~/.rbenv -type f -exec dos2unix {} \;
Hope that helps anyone else that finds this
Most helpful comment
To fix this I ran
dos2unixover the whole rbenv folder:Hope that helps anyone else that finds this