Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.sh:行22: $'\r': 未找到命令 #433

Open
leangjia opened this issue Aug 29, 2024 · 1 comment
Open

.sh:行22: $'\r': 未找到命令 #433

leangjia opened this issue Aug 29, 2024 · 1 comment

Comments

@leangjia
Copy link

linux执行sh脚本报错:$’\r’: 未找到命令的解决

@chris001
Copy link

chris001 commented Sep 1, 2024

When you see error messages like this:

-bash: '\r': command not found

Try running the dos2unix command on the file.

Why? Windows style newline characters cause this error in Linux.

The dos2unix command modifies the newline characters so they are Linux compatible.

(CAUTION: the dos2unix command modifies files in place, so take precaution if necessary. If you need to keep the original file, you should make a backup copy first.)

Then, you can run the .sh file without that error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants