在linux中执行脚本时出错 $'\r': command not found 错误原因是在脚本中有空行,如果脚本是在Windows下进行编辑之后上传到linux上去执行的话,就会出现这个问题. 因为win下的空行是/r/n,但是linux下是/n,没有识别/r,所以会导致上述的报错,这个属于脚本编码的问题. 建议: 在服务器中编写相关脚本,可以有效避免这个问题.…
Centos7下执行shell脚本报错如下 [root@ip---- ~]# sh install_zabbix_agent.sh install_zabbix_agent.: $'\r': command not found install_zabbix_agent.: $'\r': command not found install_zabbix_agent.: $'\r': command not found install_zabbix_agent.: syntax error near…
执行shell脚本如果报如下错误: syntax error near unexpected token `$'\r'' syntax error: unexpected end of file $'\r': command not found 可能原因是写代码是编辑环境是window,或者Linux下的非Linux编码, 可以执行:dos2unix filename 来解决.…
是linux无法解析$'\r'.这其实是windows与linux系统的差异导致的. 因为linux上的换行符为\n,而windows上的换行符为\r\n.所以脚本到linux上就无法解析了. 通常的处理办法主要有2种: 处理办法1 set ff=unix vi hello.sh ### Esc进入命令行运行模式 ### : set ff=unix 处理办法2 dos2unix dos2unix hello.sh ### 如果报command not found 是因为你没有安装,安装dos2u…
同事反馈他在一测试服务器(CentOS Linux release 7.2.1511)上修改了/etc/profile文件后,使用source命令不能生效,让我帮忙看看,结果使用SecureCRT一登录就发现下面错误信息: Last login: Fri Nov 4 00:42:45 2016 from 10.20.34.14 -bash: $'\r': command not found -bash: $'\r': command not found -bash: $'\r': c…
进入vi的命令 vi filename :打开或新建文件,并将光标置于第一行首 vi +n filename :打开文件,并将光标置于第n行首 vi + filename :打开文件,并将光标置于最后一行首 vi +/pattern filename:打开文件,并将光标置于第一个与pattern匹配的串处 vi -r filename :在上次正用vi编辑时发生系统崩溃,恢复filename vi filename....filename :打开多个文件,依次进行编辑 移动光标类命令h :光标左…
转自该网站:http://research.stowers-institute.org/efg/R/Color/Chart/ 科学可视化中常用的一些颜色表:http://geog.uoregon.edu/datagraphics/color_scales.htm Step-by-Step Procedure (to learn about "colors") 1. The function call, colors(), or with the British spelling, c…
Machine learning is a branch in computer science that studies the design of algorithms that can learn. Typical machine learning tasks are concept learning, function learning or “predictive modeling”, clustering and finding predictive patterns. These…
Create an ssh key: ssh-keygen Copy an SSH key to a remoate server: ssh-copy-id root@104.197.227.8 // username@ip address / hostname Then enter your password. To make sure you can SSH into remote server, you can do: ssh root@104.197.227.8 Since ssh-co…
Introduction R is a popular open source programming language that specializes in statistical computing and graphics. It is widely used by statisticians for developing statistical software and performing data analysis. One of R's strengths is that it…
1. 命令模式: 将请求封装为一个对象,从而使你可以用不同的请求对客户进行参数化,对请求排队或记录请求日志,以及支持可撤销的操作. 命令模式有点: a. 较容易的设计一个命令队列 b. 在需要的的情况下,可以较容易的将命令加入日志 c. 允许请求的一方决定是否要否决请求. d. 可以容易的实现对请求的撤销和重做. e. 加入具体新的命令类不影响其他的类. 实例: receiver.h receiver.cpp 实际操作者 烤肉者 #ifndef RECEIVER_H #define RECE…
linux换行为\n,windows换行为\r\n,windows环境编辑的shell脚本在linux下执行会报错: line 2: $'\r': command not found 查看 # cat -A test.sh #!/bin/sh^M$^M$... 解决方法: vi 1)替换 :%s/^M//g 2)设置文件格式 :set fileformat=unix…