【发布时间】:2011-11-11 01:55:54
【问题描述】:
如何将我的长字符串常量拆分为多行?
我知道你可以这样做:
echo "continuation \
lines"
>continuation lines
但是,如果您有缩进的代码,效果就不那么好了:
echo "continuation \
lines"
>continuation lines
【问题讨论】:
-
Google 的 Bash Shell 样式指南 recommends "here" documents 用于“如果您必须编写超过 80 个字符的字符串”。见@tripleee's answer。
-
google.github.io/styleguide/… -- 这是新文档中的直接链接
-
答案清楚地表明了 bash 语言是多么有趣:-)
标签: bash line indentation