如何在ssh中显示换行符 [英] How to display newline in ssh
本文介绍了如何在ssh中显示换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试执行以下操作:
I'm trying to do the following:
#!/bin/sh
ssh user@server "echo \"Test \n for newline\""
这将显示:
test \n for newline
如何让外壳程序将\n
解释为实际的换行符?
How do I get the shell to interpret \n
as an actual newline?
推荐答案
尝试使用-e
选项,例如echo -e "Test \n for newline"
.
如果您的echo
没有-e
选项,那么我将使用printf
.它具有广泛的用途,并且在实现上几乎没有太多变化.
If your echo
doesn't have a -e
option, then I'd use printf
. It's widely available and it does not have nearly as many variations in it's implementations.
这篇关于如何在ssh中显示换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文