Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

windows - env: bash : No such file or directory

I'm trying to install YouCompleteMe from here.

When I execute:

./install.sh --clang-completer

I get this error:

env: bash
: No such file or directory

I don't know what's wrong with environment variables. Here's my bash path:

which bash 
/bin/bash

Do I need to change it to /usr/bash? If yes, then how should I do that? I tried changing ~/.bashrc file, but it didn't work.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The error message suggests that the script you're invoking has embedded characters, which in turn suggests that it has Windows-style line endings instead of the -only line endings bash expects.

As a quick fix, you can remove the chars. as follows:

sed $'s/
$//' ./install.sh > ./install.Unix.sh

Note: The $'...' string is an ANSI-C quoted string supported in bash, ksh, and zsh. It is used to ensure that the expands to an actual CR character before sed sees the script, because not all sed implementations themselves support as an escape sequence.

and then run

./install.Unix.sh --clang-completer

However, the larger question is why you've ended up with -style files - most likely, other files are affected, too.

Perhaps you're running Git on Windows, where a typical configuration is to convert Unix-style -only line breaks to Windows-style line breaks on checking files out and re-converting to -only line breaks on committing.

While this makes sense for development on Windows, it gets in the way of installation scenarios like these.

To make Git check out files with Unix-style file endings on Windows - at least temporarily - use:

git config --global core.autocrlf false

Then run your installation commands involving git clone again.

To restore Git's behavior later, run git config --global core.autocrlf true.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...