Perl:Net :: Appliance :: Session ssh连接在输出上给出了奇怪的字符

时间:2018-05-18 22:32:13

标签: perl ssh

我使用perl 5.8.8与Net :: Appliance :: Session 1.36和vim作为编辑器。 在开发环境中,当我连接到基于Linux的网络盒并发送命令并捕获输出时,我会在这里得到奇怪的字符加上加倍的提示:

^[]0;

我写的奇怪人物是:

Cisco Mobility Service Engine

root@xxx.xxx.xxx.xxx's password:
Last login: Tue May 15 10:59:10 from xxx.xxx.xxx.xxx^M
[root@HOSTNAME ~]# #no-paging-command^M
[root@HOSTNAME ~]#  $TIMESTAMP$=1526517216 ^Gecho no-paging-command^M
no-paging-command^M
[root@HOSTNAME ~]# ^G^M
[root@HOSTNAME ~]#  $TIMESTAMP$=1526517216 ^Ggetserverinfo^M

此问题在测试和生产环境中看起来更好:

WITH CTE_Position
AS
(
SELECT 'Test' AS A, 1 AS B, 1 AS C, 5 AS Total, CONVERT(DATE, '05/10/2018') AS [Date]
UNION ALL
SELECT 'Test' AS A, 1 AS B, 2 AS C, 6 AS Total, NULL AS [Date]
UNION ALL
SELECT 'Test' AS A, 2 AS B, 3 AS C, 5 AS Total, CONVERT(DATE, '05/10/2018') AS [Date]
UNION ALL
SELECT 'Test' AS A, 2 AS B, 4 AS C, 6 AS Total, NULL AS [Date]
    UNION ALL
    SELECT 'Test' AS A, 3 AS B, 5 AS C, 5 AS Total, CONVERT(DATE, '05/10/2018') AS [Date]
UNION ALL
SELECT 'Test' AS A, 3 AS B, 6 AS C, 6 AS Total, NULL AS [Date]
UNION ALL
SELECT 'Test' AS A, 4 AS B, 7 AS C, 5 AS Total, CONVERT(DATE, '05/10/2018') AS [Date]
)
SELECT p1.A, p1.B, p1.C
,Total = (CASE WHEN SUM(p2.Total) IS NULL OR SUM(p2.Total) = 0 THEN SUM(p1.Total)
ELSE SUM(p1.Total + p2.Total) END)
,p1.[Date]
FROM CTE_Position p1
LEFT JOIN CTE_Position p2
ON p1.A = p2.A
AND p1.B = p2.B 
AND p2.[Date] IS NULL
WHERE
p1.[Date] IS NOT NULL
GROUP BY
p1.A, p1.B, p1.C, p1.[DATE]

在这种情况下,不同输出的根本原因是什么?

谢谢你的建议!

1 个答案:

答案 0 :(得分:-1)

您对那些奇怪的字符是正确的,这些字符是ASCI字符,用于设置其他终端功能,这些特征对于perl脚本进行解析非常烦人。 我摆脱它们的方法是使用crontab,就像在生产环境中运行脚本一样。