Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我通过串行连接连接到远程主机来编写一些期望脚本。
我的问题是衍生进程的输出(使用 启用log_user 1)包含 DOS 样式的结尾(^M在 VIM 中读取日志时,每一行都以终止)。
log_user 1
^M
我通常dos2unix在期望会话结束时对所有日志运行,以摆脱它们。转换可以实时完成吗?
dos2unix
原来问题真的很简单。
我正在用我的脚本做的是像下面这样调用它们:
expect script.exp > mylog
如描述中所述,mylog在^MVim 中打开或使用cat -v mylog.
mylog
cat -v mylog
为了实时摆脱它们,我现在打电话:
expect script.exp | tr -d '\r' > mylog