$‘\r‘: command not found
时间: 2023-10-07 12:08:10 浏览: 48
This error message indicates that the command being executed is not recognized by the system.
The characters '\r' typically represent a carriage return character, which is often used in text files to indicate the end of a line. However, if it is entered as a command in the terminal, it will not be recognized as a valid command.
To resolve this issue, check that the command being executed is correct and does not contain any typos or extra characters. If the command is correct, try running it again without the '\r' character.
相关问题
bash: R: command not found...
以下是解决bash脚本运行时报$’\r’: command not found错误的两种方法:
1. 使用sed命令将Windows格式的换行符转换为Linux格式的换行符:
```shell
sed -i 's/\r$//' your_script.sh
```
2. 使用dos2unix命令将Windows格式的换行符转换为Linux格式的换行符:
```shell
dos2unix your_script.sh
```
line 3: $'\r': command not found
这个错误是因为在Windows系统中编写的Shell脚本在Linux系统中运行时出现了换行符的问题。解决方法是去除脚本中的\r字符。可以使用sed命令来实现这个操作。
```shell
sed -i 's/\r//' run.sh
```
这个命令会将run.sh文件中的所有\r字符替换为空字符,从而解决这个错误。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)