- 论坛徽章:
- 0
|
从网上收集了一下关于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 |
|