免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2214 | 回复: 0
打印 上一主题 下一主题

解决执行dos2unix 和unix2dos命令时得到的错误 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-11-18 10:01 |只看该作者 |倒序浏览

从网上收集了一下关于dos2unix命令出错的资料。
背景:
windows下的文档上传到solairs下有时会发现每一行多了个^M,那个^M是DOS(WINDOWS)文件上传时没有将回车+换行符转换而产生的。如果使用FTP上传的话,对这样的文本文件,应该使用ASCII方式,这样上传时FTP会根据两边的文件系统的格式进行必要的转换,上传后的UNIX文件中就没有那个^M了。这就是FTP中那个“P”的作用(Protocol,协议)。 对二进制文件(图形、压缩、执行等),FTP传送时一定要用BINARY方式,不然它会自作聪明地转换的。如果是采用自己的通信软件传送,那么在处理DOS的回车+换行符(
,16进的0Dh 0Ah)时把(0Dh)去掉不传就可以了。
在SunOS下执行dos2unix或者unix2dos时,尽管命令执行成功但会得到提示:
could not open /dev/kbd to get keyboard type US keyboard assumed
could not get keyboard type US keyboard assumed
这是Sun的一个bug.
解决方法:
1、忽略这个提示
2、使用-437选项

在Solaris下man dos2unix
-437 代表 use US code page.
下面是这个bug的官方说明:
SUN bug id:3002342
http://sunsolve.sun.com/search/document.do?assetkey=1-1-3002342-1&searchclause=3002342

Document Audience:        SPECTRUM
Document ID:        3002342
Title:        *dos2unix* dos2unix and unix2dos want /dev/kbd
Update Date:        Thu May 15 11:33:00 MDT 1997
Bug ID: 3002342
Synopsis: *dos2unix* dos2unix and unix2dos want /dev/kbd
Category: utility
Subcategory: conversion
State: closed
Priority:
    Responsible Manager:
    Responsible Engineer:
Description:
Both dos2unix and unix2dos print out:
could not open /dev/kbd to get keyboard type US keyboard assumed
could not get keyboard type US keyboard assumed
This is a problem because:
1. There is no /dev/kbd.
2. Even if there was a /dev/kbd, these programs are trying to
do the keyboard ioctl KIOCLAYOUT that returns the nationality of the
keyboard.
Under x86 the I don't think that the keyboard ioctl exists, and the
keyboards do not
have unique gettable numbers that are the nationality.  Some other scheme
would be necessary.
Work Around:
Ignore the message, or use the intuitive -437 flag.
Integrated in releases: ,
Duplicate of: 1148242
Patch ID: ,
See Also: 1148242, 4650509,
Summary:


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/7635/showart_57568.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP