Bash 在此处缩排文档
示例
您可以在此处的带有标签的文档内缩排文本,需要使用<<-重定向运算符而不是<<:
$ cat <<- EOF
This is some content indented with tabs `\t`.
You cannot indent with spaces you __have__ to use tabs.
Bash will remove empty space before these lines.
__Note__: Be sure to replace spaces with tabs when copying this example.
EOF
This is some content indented with tabs _\t_.
You cannot indent with spaces you __have__ to use tabs.
Bash will remove empty space before these lines.
__Note__: Be sure to replace spaces with tabs when copying this example.这样的一个实际用例(如所述manbash)在shell脚本中,例如:
if cond; then
cat <<- EOF
hello
there
EOF
fi通常,如本if语句所述,在代码块内缩进行,以提高可读性。没有<<-运算符语法,我们将被迫编写上述代码,如下所示:
if cond; then
cat << EOF
hello
there
EOF
fi读起来很不愉快,而且在更复杂的现实脚本中情况变得更糟。
热门推荐
10 八一幼儿祝福语大全简短
11 公司乔迁食堂祝福语简短
12 婚礼结束聚餐祝福语简短
13 儿媳买车妈妈祝福语简短
14 毕业送礼老师祝福语简短
15 同事辞职正常祝福语简短
16 恭贺新婚文案祝福语简短
17 金店立秋祝福语简短英文
18 婆婆高寿祝福语大全简短