开发者

Dialog vs. '\n'

开发者 https://www.devze.com 2023-03-30 06:51 出处:网络
I\'m trying to use dialog to show some data, but unfortunatly the data might contain \"\\n\" substring (2 ch开发者_C百科aracters: \\ and n, and not literal enter character).

I'm trying to use dialog to show some data, but unfortunatly the data might contain "\n" substring (2 ch开发者_C百科aracters: \ and n, and not literal enter character).

It looks that whatever I will do, dialog interprets those \n as literal enter, and breaks the content.

For example you can try:

dialog --infobox "a\\nb" 10 10

and:

echo "a\\nb"

Is there any way to disable this \n interpolation, or escape it somehow? I tried with up to 6 \ characters in front of \ but it doesn't help.


This should do the trick, however it doesn't seem you can mix both types. You either have "forced" \n interpretation, or none at all:

dialog --no-nl-expand ...
0

精彩评论

暂无评论...
验证码 换一张
取 消