从源代码安装Ansible - hacking / env-setup失败

时间:2016-05-28 18:58:44

标签: python ansible

我正在尝试从源代码安装ansible。我做了:

sudo apt-get install python2.7-dev
sudo pip install paramiko PyYAML Jinja2 httplib2
git clone git://github.com/ansible/ansible.git --recursive

然后,当我尝试

~/src/ansible$ source ./hacking/env-setup

我得到了

: command not found
: command not found
bash: ./hacking/env-setup: line 17: syntax error near unexpected token `elif'
'ash: ./hacking/env-setup: line 17: `elif [ $(basename -- "$0") = "env-setup" ]; then

知道缺少什么吗?

1 个答案:

答案 0 :(得分:2)

您的env-setup中是否碰巧有dos行结尾?检查你的core.autocrlf设置,这不应该是真的。如果是,请执行:

  public static int luhnCardValidator(int cardNumbers[]) {
                int sum = 0, nxtDigit;
                for (int i = 0; i<cardNumbers.length; i++) {
                    if (i % 2 == 0) 
                      nxtDigit  = (nxtDigit > 4) ? (nxtDigit * 2 - 10) + 1 : nxtDigit * 2;
                    sum += nxtDigit;
                }
                return (sum % 10);
            }