linux中没有dos2UNIX或者UNIX2dos命令怎么解决办法

来源:互联网 发布:js 箭头函数作用域 编辑:程序博客网 时间:2024/06/05 03:50

背景:用cygwin运行shell命令发现符号会报错,查了发现没有多余的字符。

原因:linux中回车换行是两个字符,windows中是一个字符。

解决办法:在notepad++上代开code,点击视图-显示所有字符,会看到回车确实是两个字符,点击编辑,将字符转换成unix格式即可。


下面是查找到的解决办法。

[root@localhost ~]#dos2unix tr.py 
-bash: dos2unix: command not found

安装方法:

在http://linux.softpedia.com/progDownload/Dos2Unix-Download-5519.html下载hd2u-1.0.0.tgz

[root@localhost ~]#tar -zxf hd2u-1.0.0.tgz

[root@localhost ~]#cd hd2u-1.0.0

[root@localhost ~]#./configure

[python] view plaincopy
  1. Configuring hd2u 1.0.0  
  2. checking for gcc... gcc  
  3. checking for C compiler default output file name... a.out  
  4. checking whether the C compiler works... yes  
  5. checking whether we are cross compiling... no  
  6. checking for suffix of executables...   
  7. checking for suffix of object files... o  
  8. checking whether we are using the GNU C compiler... yes  
  9. checking whether gcc accepts -g... yes  
  10. checking for gcc option to accept ANSI C... none needed  
  11. checking for a BSD-compatible install... /usr/bin/install -c  
  12. checking for getopt_long in -lpopt... no  
  13. configure: error: *** libpopt not found  
[python] view plaincopy
  1. Configuring hd2u 1.0.0  
  2. checking for gcc... gcc  
  3. checking for C compiler default output file name... a.out  
  4. checking whether the C compiler works... yes  
  5. checking whether we are cross compiling... no  
  6. checking for suffix of executables...   
  7. checking for suffix of object files... o  
  8. checking whether we are using the GNU C compiler... yes  
  9. checking whether gcc accepts -g... yes  
  10. checking for gcc option to accept ANSI C... none needed  
  11. checking for a BSD-compatible install... /usr/bin/install -c  
  12. checking for getopt_long in -lpopt... no  
  13. configure: error: *** libpopt not found  

在http://rpm.pbone.net/index.php3/stat/4/idpl/17960519/dir/other/com/popt-1.14-2rt.x86_64.rpm.html下载popt-1.14-2rt.x86_64.rpm

[root@localhost ~]#rpm  -ivh popt-1.14-2rt.x86_64.rpm

[root@localhost ~]#cd hd2u-1.0.0

[root@localhost ~]#./configure&&make&&make install

[root@localhost ~]#whereis dos2unix

dos2unix: /usr/local/bin/dos2unix

安装成功


0 0
原创粉丝点击